*sorry if the subject is not good but i didn't know what to right in it.
I have a code to connect Access Database with my C# Windows Forms program. The program is a school test .. as i get the question and the multiple answers from the database.I have 7 questions written in that access database. My problem is that when i run the code, I only get the last question (question number 7) but I want to show another question from another row in the database (the question I want).
OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=..\Release\AppDB.accdb");
con.Open();
DataTable dt = new DataTable();
DataSet ds = new DataSet();
ds.Tables.Add(dt);
OleDbDataAdapter da = new OleDbDataAdapter("Select * from Table1", con);
da.Fill(dt);
foreach (DataRow myRow in dt.Rows)
{
label1.Text = "Question " + myRow[0] + " / " + myRow[1].ToString();
radioButton1.Text = myRow[2].ToString();
radioButton2.Text = myRow[3].ToString();
radioButton3.Text = myRow[4].ToString();
radioButton4.Text = myRow[5].ToString();
label3.Text = myRow[6].ToString();
}
con.Close();