TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ajay Kadian
NA
122
32k
how to access random data from database
Mar 18 2014 7:37 AM
Hi,
I have a MS access database. In that, one table consists of questions,option and answers.
I need to retrieve random question from that table using Question Type but one by one it means at button click it shows one question on next click next question so on.
I have the code but it doesn't work.
And Please tell me it is possible to pass value One column value to textBox and 4 option column value to 4 button and if we click a button if its text value matches with answer(i.e in other column) then backcolor of button green else red.
cn.Open();
OleDbConnection con = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=E:\\C#\\Database1.accdb");
OleDbCommand cmd = new OleDbCommand("SELECT top 1 row Type from QUESTION ORDER BY rnd()", cn);
OleDbDataAdapter adp = new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
adp = new OleDbDataAdapter("Select * from QUESTION", cn);
adp.Fill(ds, "QUESTION");
dataGridView1.DataSource = ds.Tables["QUESTION"];
cn.Close();
Reply
Answers (
1
)
Break string Using Regular Expressions
App close