1.enter the empid .(for example emp345).
2.next to click open button.
3.after to display the all field.(name,experience,age,dob,sex)
(my problem i enter the empid.after to not display the field(age,name,experience,..etc).no errer msg.but not open the field.
so ,send me correct code sir,)
Amit ChoudharyPosted Mar 19, 2010, 9:05 AM
send your code... i can help you.
ilaPosted Mar 19, 2010, 5:11 AM
private void Btn_Search_Click(object sender, EventArgs e)
{
conn.Open();
int f = 0;
try
{
SqlCommand cmd = new SqlCommand(@"select * from HBTs_Details",conn);
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
if (text_Name.Text == rdr[0].ToString())
{
text_No.Text = rdr[1].ToString();
text_Id.Text = rdr[2].ToString();
text_Address.Text = rdr[3].ToString();
f = 1;
}
}
if(f!=1)
{
MessageBox.Show("No such Record");
}
rdr.Close();
conn.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
If u accept this answer mark it as accepted