Hi Guys quick question,
I have quick question. I have 4 textbox's which searches data from a data base. But what i want to do is if the user only enters a some data in to one or two of the textbox's to search a query and retrieve the record that matches some of the text using the"LIKE " command . The way i was going to do it was use a lot of if else statements like
if (tbDocID.Text != null)
{
searchAllCom = new OleDbCommand("SELECT * FROM Doctors WHERE Doctors_ID =" +tbDocID.Text+" ", conToDataBase);
}
else if (tbForname.Text != null)
{
searchAllCom = new OleDbCommand("SELECT * FROM Doctors WHERE Forename LIKE'" + tbForname.Text + "%'", conToDataBase);
}But i know there must be a better and cleaner way to do this . So any idea would be appreicated
Thanks