T
Thushan Withanage
Guest
I want to get a record, from a sql server database table, into text boxes. some fields are empty. when i use the sqldatareader to get the record it says cannot get null data usingsqldatareader.
the value in the column
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
search_btn_click()
{
con.open();
cmd = new SqlCommand("select * from Student",con);
dr = cmd.ExcecuteReader();
while(dr.Read())
{
txt1.Text = dr.GetString(0);
txt2.Text = dr.GetString(1); //This column can be either
//null or not null
txt3.Text = dr.GetString(2);
txt4.Text = dr.GetString(3);
}
dr.Close();
con.Close();
}
can be either null or not null.
if the value is not null, i want to fill the text box with the value.
Continue reading...
the value in the column
SqlConnection con;
SqlCommand cmd;
SqlDataReader dr;
search_btn_click()
{
con.open();
cmd = new SqlCommand("select * from Student",con);
dr = cmd.ExcecuteReader();
while(dr.Read())
{
txt1.Text = dr.GetString(0);
txt2.Text = dr.GetString(1); //This column can be either
//null or not null
txt3.Text = dr.GetString(2);
txt4.Text = dr.GetString(3);
}
dr.Close();
con.Close();
}
can be either null or not null.
if the value is not null, i want to fill the text box with the value.
Continue reading...