|
-
Jul 27th, 2004, 04:02 PM
#1
Thread Starter
New Member
Best way to Handle Database?
well, heres my dilemma, i need to write an online quiz, and all the questions, answer choices, etc. are stored in a database. I was wondering if it would be a better idea to store all the questions in an array at first and then write each element in the array for the test, and send back all the results at the end to another database? or would it be a better idea to draw one question, send back the answer, and draw another question? Which way would you guys reccomend, since i'm new at asp.net, i don't know a majority of the functions that asp.net is capable of, so if you guys have any other suggestiongs, that'll be good too.
Thanks!
-
Jul 27th, 2004, 04:09 PM
#2
I wonder how many charact
I would probably just use a DataList or Repeater... (with a RadioButtonList inside its ItemTemplate)... then you could bind to a datatable, and simply use a datadapter to update the database's table(s).
You can use a datareader as well, there are about 5 ways to accomplish this... what are you most comfortable with?
-
Jul 27th, 2004, 05:16 PM
#3
Thread Starter
New Member
i'm not too familiar w/ datalist or a repeater, but i just read up on it, and heres the problem w/ using them, i can only display one question at a time, and when the user answers the questoin another question will appear, i tried the array idea, but i can't figure out how to get it to store diff lines in a column to an arraylist...
Dim myconnection As SqlConnection = New SqlConnection("server=(local);database=test1;trusted_connection=sspi")
Dim mycommand As SqlCommand = New SqlCommand("select question from quiz1", myconnection)
Dim qnum As Integer
Dim myquestions = New ArrayList
myconnection.Open()
Dim myreader As SqlDataReader = mycommand.ExecuteReader()
While myreader.Read()
For qnum = 1 To 9
myquestions.add = (myreader.GetSqlSingle(qnum))
Next
myquestions.trimtosize()
rb.DataSource = myquestions
rb.DataBind()
End While
myreader.Close()
End Sub
whats wrong/!?!?!
it says i'm outside the bound of my array...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|