• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 13. Serving from SQL > Trial-and-Error Approach

Trial-and-Error Approach

We will use the rand command to determine which question to send via XML to the client. We find the minimum and maximum QuIDs and use those two values as the boundaries for our rand command. But there may be invalid values in this range because some QuIDs were skipped in data entry or by later deletion of questions. So we could write code that follows the logic of Figure 13.2 and looks like this:

Figure 13.2. Guess and Check to Find Valid QuIDs



PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint