Hi all plz help i need to search my database using data from the combo box which works fine
the problem that I an experiencing is that FIND function gives me a runtime error, saying the string is not
in the correct format plz help. here is the code that i used.
string data = this.cmbSearch.Items[this.cmbSearch.SelectedIndex].ToString();
OleDbConnection conn = new OleDbConnection(strCon);
OleDbDataAdapter adapter = new OleDbDataAdapter("SELECT * FROM Employee",conn);
OleDbCommandBuilder oleBuilder = new OleDbCommandBuilder(adapter);
DataSet ds = new DataSet();
adapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
adapter.Fill(ds,"Employee");
DataRow findrow;
findrow = ds.Tables["Employee"].Rows.Find(data);
if (findrow == null)
{
MessageBox.Show("Please recheck your spelling", "Employee Not Found",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
else
{
string labeldata = this.cmbSearch.Items[cmbSearch.SelectedIndex].ToString();
form2.EmployeeDisplay(data, labeldata);
form2.Show();
form2.Text = this.cmbSearch.Items[cmbSearch.SelectedIndex].ToString();
}