Join our DNN Community    (Newsletter, Tips, Tricks and Forums for DNN Skins & Modules)

 


 
Microsoft Gold Certified Partner - DNN Benefactor

DotNetNuke Powered! 


Monday, December 01, 2008 Register · Login · Contact · Search:  
Company Solutions Portfolio Contact
Forums
General
The ever-powerful ListX module forum. Post your questions, new configuration ideas and reviews.
Subject: Are There Any "While Loop" Examples?

You are not authorized to post a reply.   
Author Messages
alewjr
Featherweight
Posts:12

06/21/2007 10:17 AM Alert 
Here's what I'm trying to do. I have a table that has a list of question. Each has a question number associated with them. If an admin deletes one of the questions, I would like all of the questions after it to update their question numbers to reflect the change (ie If question 5 gets deleted, question 6,7,8,9,10 become question 5,6,7,8,9). I'm trying to perform this in an Action:Execute statement. Here's what I have, but I know this is absolutely wrong. I just want to give the data structures:

DECLARE QuesVar CURSOR FOR
SELECT QuesNum FROM PPM_Questions
WHERE QuesNum > [QuesNum,DelQuesNum] AND QuesNum < [QuesNum,MaxQuesNum]
OPEN QuesVar
WHILE @@FETCH_STATUS = 0
BEGIN
UPDATE PPM_Questions SET QuesNum=QuesNum - 1
FETCH NEXT FROM QuesVar
END
CLOSE QuesVar
DEALLOCATE QuesVar

The DelQuesNum gets the question number that is being deleted and the MaxQuesNum gets the last question number.
You are not authorized to post a reply.
Forums > Bi4ce.Modules.ListX > General > Are There Any "While Loop" Examples?



ActiveForums 3.6
Latest Post
 
At R2integrated (formerly Bi4ce), we take support seriously.  That's why we support our customers and DNN community with daily monitoring from our experienced engineering team.  We ask that the first step taken is to read the relevant documentation and support forums prior to submitting any questions that may already be available or have been answered.  We ask that you review the documentation that we provide for our products before posting a question.

The Forums are for our customers to chat, exchange ideas and strategies, and submit feedback.  Please be sure to perform keyword searches for previous related forum responses.

To be helpful when submitting a new item, please include the following: 
  1. DNN Version
  2. Module Version
  3. Admin Log Viewer Information
  4. Environment detail: Operating system, .NET framework version, database and version, IIS version, Browser version (if appropriate)
We always try to respond quickly and monitor the forums daily during business hours (EST).  Occasionally, requests for a specific project requirement may not apply for the free support offered. For project specific support please submit via our Information Request form.

Thank you for using our Forums.

Click here to register for the Forums
 
© 2008 by R2integrated (formerly Bi4ce) | DNN® is a registered trademark of DotNetNuke Corporation