Hi Rectus,
Please try like this
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection Cn = new SqlConnection("server=OM-PC;database=master;uid=SA;pwd=123");
string query="SELECT * FROM DEPT WHERE DNO="+ Convert.ToInt32(TextBox1.Text);
string query="SELECT * FROM DEPT WHERE DNO='"+ Convert.ToInt32(TextBox1.Text)+"'";
SqlCommand Cmd = new SqlCommand(query, Cn);
Cn.Open();
SqlDataReader Dr = Cmd.ExecuteReader();
GridView1.DataSource = Dr;
GridView1.DataBind();
Dr.Close();
Cn.Close();
}
}
I hope this will help you in your problem. Please make it resolved if it helps you.
Thanks and Regards
Suman Zalodiya