For that you have to pass search key in select statement, after that based on where condion you can get values from database.
try this code-
protected void GetDetails_Click(object sender, EventArgs e)
{
{
SqlConnection con = new SqlConnection("con string ");
SqlDataAdapter da;
string mySQL = "SELECT * FROM emptable where empid='" + TxtEmpId.Text + "' ";
da = new SqlDataAdapter(mySQL, con);
con.Open();
DataSet ds = new DataSet();
da.Fill(ds);
if(ds.Tables[0].Rows.Count>0)
{
//Now Filling Details-
TxtEmpId.Text= ds.Tables[0].Rows[0][0].ToString(); //for id
TxtEmpName.Text= ds.Tables[0].Rows[0][1].ToString(); //for name
}
}
Try this code and let me know.