Code:
SqlConnection dbCon = new SqlConnectio(connectionstring);
SqlCommand sqlCom = new SqlCommand();
sqlCom.CommandText = "SELECT FROM rizha";//comment:rizha is a table
try
{
SqlDataReader dr;
dbCon.Open();
dr = sqlCom.ExecuteReader();
if (dr.HasRows == true )
{//comment:I run with break piont and I undrestand this line never run in debuging and i dont know why?
textBox7.Text = (String)dr["tnine"];
}//comment:"tnine" is a record
dr.Close();
dbCon.Close();
while (dr.Read())
{
textBox7.Text=textBox7.Text+ (dr["tnine"]).ToString();
//comment:use textBox to access data
}
}
catch (Exception ex)
{ }
}
Comment