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.

Akshay PhadkeRank #161 · 14.6K reputationPosted Jun 24, 2016, 9:28 AM EDT
Lukas Kuutondokwa15 reputationPosted Jun 24, 2016, 9:38 AM EDT
Akshay PhadkeRank #161 · 14.6K reputationPosted Jun 24, 2016, 9:40 AM EDT
Lukas Kuutondokwa15 reputationPosted Jun 24, 2016, 9:55 AM EDT
Akshay PhadkeRank #161 · 14.6K reputationPosted Jun 24, 2016, 10:08 AM EDT
Lukas Kuutondokwa15 reputationPosted Jun 24, 2016, 10:33 AM EDT
//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");
}
Lukas Kuutondokwa15 reputationPosted Jun 24, 2016, 10:38 AM EDT
AccountNumber= ds.Tables[0].Rows.IndexOf(record);