i ve make table in sql server and wanted to reterive one by one row in windows form... in case ov correct there must be inclement in score....... but question is not appaering in lable1 in windows form as well as options in radio buttons... plz plz help me out
private void Form1_Load(object sender, EventArgs e)
{
string constring ="Server=TAHIRA-7B0ECEAE\\SQLEXPRESS;integrated security=SSPI;database=MCQ";
SqlConnection conn = new SqlConnection (constring);
conn.Open();
string Sql = "select * from table_1";
SqlCommand cmd = new SqlCommand(Sql,conn);
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read());
label1.Text=reader[0];
radioButton1.Text=reader[1];
radioButton2.Text=reader[2];
radioButton3.Text=reader[3];
cmd.ExecuteNonQuery();
Loading
tAhIra sgdPosted Apr 22, 2011, 11:14 AM
Jonathas SucupiraPosted Apr 21, 2011, 6:31 PM
private void Form1_Load(object sender, EventArgs e)
{
string constring ="Server=TAHIRA-7B0ECEAE\\SQLEXPRESS;integrated security=SSPI;database=MCQ";
SqlConnection conn = new SqlConnection (constring);
conn.Open();
string Sql = "select * from table_1";
SqlCommand cmd = new SqlCommand(Sql,conn);
Try
{
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
label1.text = reader["the tabel field1"].ToString();
radiobutton1.text = reader["the table field2"].tostring();
//ETC
}
}
Catch (Exception e)
{
response.write("Error: " + e.message);
}
tAhIra sgdPosted Apr 21, 2011, 5:29 PM
Suthish NairPosted Apr 20, 2011, 5:21 PM