I am brand spanking new to runtime db connections. I have a simple query problem that I can't seem to input the correct search criteria into Google find help.
Facts:
Using OleDB
runtime dev
Issue: I have a text box I want to use as the condition in which to query my Customer table and produce results in a DataGridView in VB. Everytime I execute my code I get the following: "Syntax error in string in query expression 'LastName >= (textbox contents)"
Here is my small sub executing this query:
Can anyone throw me a bone on this? My Gaddis book is just completely useless on database use.Code:Public Sub SearchMenu() Dim SearchBox As String SearchBox = frmMain.txtName.Text Connection.Open() dvdDataSet.Clear() accCommand.CommandText = "SELECT * FROM Customer WHERE LastName >=' " & SearchBox accCommand.Connection = Connection dvdDataAdapter.SelectCommand = accCommand dvdDataAdapter.Fill(dvdDataSet, "Customers") frmMain.dvgFrmMain.DataSource = dvdDataSet.Tables("Customers") End Sub
Thanks a lot.





Reply With Quote