The current implementation only looks at the first record returned and builds an output string with the question and answer options.
If there was more than one question matched, how would it work?
Should this return all of the questions delimited in some fashion?
Should it always return a list of questions, that might be empty?
Should you pass a question index into this method and keep calling it until it returns something indicating no more questions?
How would the user interact with it?
Would all of the questions for the day be on the same page, or would you want one page per question?
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116
The current database search uses where qdate = #" + DateTime.Now.ToString("dd-MMM-yyyy") + "#" which limits the search to only find records for the given date.
You could extend that to have a 'morning', 'afternoon' and 'evening/night' questions using time...
The only other was to implement it would be to somehow get the information as to whether or not the current user has already seen a particular question. (Maybe you could keep a last date/question index for each user?)
If the last question date was today's date, then select the next index question (if any).
Note that the database would need to have a field to establish the order that questions would be presented during the day.
Also note that some entity must be populating the database with questions for future dates so that when the date arrives there is a question available. The entity would have to support adding more than one question for a given date, potentially including an order in which the questions were to be presented.
Now you put some effort into the problem if you want me to post any more, the "I just can't think of anything" is all worn out.
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116
To restrict questions to x per day, or hour or whatever means you would have to log someones efforts.. or you select x questions that may run in a day and then randomize.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Well with the questions per day thing you could dump their previous count each morning at midnight.
LizR
Posting Virtuoso
1,791 posts since Aug 2008
Reputation Points: 196
Solved Threads: 190
Is time a reserved word? Could you name the column qtime like you did qdate?
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116
I was trying things in a test application.
DateTime.Now.ToString("HH:mm:ss") and DateTime.Now.ToString("hh:mm:ss tt")
both seem to produce valid output.
Does SQL like one format better than the other?
Murtan
Practically a Master Poster
671 posts since May 2008
Reputation Points: 344
Solved Threads: 116