Search from Ms Access and desplay record in labels
Suppose I have lblName, lblSurname, lblBalance. now my primary key is Name, how do i search for a record using a text box (txtSearch) to search for a record and then display the record in the above labels, lets say m using btnSearch button.
Lukas KuutondokwaPosted Jun 24, 2016, 2:38 PM
AccountNumber= ds.Tables[0].Rows.IndexOf(record);
Lukas KuutondokwaPosted Jun 24, 2016, 2:33 PM
//Using inputbox to search.....i removed the text box
{
int n = Convert.ToInt32(Interaction.InputBox("Enter Account Name:", "Search", "20", 200, 200));
DataRow record = ds.Tables[0].Rows.Find(n);
if (record != null)
{
AccountName= ds.Tables[0].Rows.IndexOf(record);
lblName.Text = record[0].ToString();
lblAccount.Text = record[1].ToString();
lblBalance.Text = record[2].ToString();
}
else
MessageBox.Show("Record not found");
}
Akshay PhadkePosted Jun 24, 2016, 2:08 PM
Lukas KuutondokwaPosted Jun 24, 2016, 1:55 PM
Akshay PhadkePosted Jun 24, 2016, 1:40 PM
Lukas KuutondokwaPosted Jun 24, 2016, 1:38 PM
Akshay PhadkePosted Jun 24, 2016, 1:28 PM