SqlCommand cmd = new SqlCommand("select * from emp_master where Employee_id='" + TextBox17.Text+ "'", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
if (ds.Tables[0].Rows.Count == 0)
{
Label18.Text = "Record not found";
}
else
{
TextBox1.Text = ds.Tables[0].Rows[0]["Employee_id"].ToString();
TextBox2.Text = ds.Tables[0].Rows[0]["Name"].ToString();
TextBox3.Text = ds.Tables[0].Rows[0]["Date_of_Birth"].ToString();
TextBox4.Text = ds.Tables[0].Rows[0]["Date_of_joining"].ToString();
DropDownList1.Text = ds.Tables[0].Rows[0]["Gender"].ToString();
DropDownList2.Text = ds.Tables[0].Rows[0]["Categoryorcaste"].ToString();
TextBox5.Text = ds.Tables[0].Rows[0]["Dept_id"].ToString();
TextBox6.Text = ds.Tables[0].Rows[0]["Designation_id"].ToString();
TextBox7.Text = ds.Tables[0].Rows[0]["Grade_id"].ToString();
TextBox8.Text = ds.Tables[0].Rows[0]["PAN_NO"].ToString();
Label18.Text = "Record Found";
}
No comments:
Post a Comment