Hello, I have the following SQL Statement, I will have about 8 different textboxes, for different search criteria, firstname, lastlame, amountpaid, etc... I will just use 2 for the example though. Right now, if I put in the first and lastname, it finds them. If I only put one or the other in, it throws an error, saying that one of them was null. I would like the user to be able to search by any of the criteria, making none of them required.
Cmd.CommandText = "SELECT ReceiptNo, PolicyNo, pmt1, pmt2, pmt3, type1, type2, type3, total, rcvdby, firstname, lastname, typeaccount, company, checkmaker, checkno, Datercvd, notebox FROM Receiptinfo WHERE firstname='" & txtfirstname.Text & "' Or lastname='" & txtlastname.Text & "';"
Cmd.CommandType = CommandType.Text
Da = New OleDb.OleDbDataAdapter(Cmd)
DGResults.DataSource = DsSearch1.Receiptinfo