Syntax error (missing operator) in query expression

CIMStu

Member
Joined
Mar 9, 2010
Messages
13
Programming Experience
Beginner
Hi All

I am trying to populate a datagrid where the value in a column from an access table matches the text in one of my combo boxes, however i get the following error

Syntax error (missing operator) in query expression 'A/C REF ='1843''.

Code is below, can anyone assist and point out what i am doing wrong?

Thanks


VB.NET:
Dim dbAdapter As OleDb.OleDbDataAdapter
        Dim ConsignmentDataset As New DataSet()
        Dim strConsignmentConnection As String

        strConsignmentConnection = "SELECT * FROM CONSIGNMENTSTOCK WHERE A/C REF ='" & cmbProcessACRef.Text & "'"
        dbAdapter = New OleDb.OleDbDataAdapter(strConsignmentConnection, oConsignmentStock)

        dbAdapter.Fill(ConsignmentDataset, "CONSIGNMENTSTOCK")
        Dim clientview As New DataView(ConsignmentDataset.Tables("CONSIGNMENTSTOCK"))
dgvProcess.DataSource = clientviewThis is my first attempt at using datagrids so be gentle if there is an obvious mistake in their!
 
I'll be as gentle as I can :)

Think about this statement carefully - "what does A divided by C equal?"

By the way, using parameters would be safer - see the link in my signature.
 
Sorry "A/C Ref" is my Column header Name and it does indeed equal 1843.

(This is a string as the A/C Ref could be letters & numbers, just not in this instance)


I will take a look at the link! Thanks
 
Last edited:
Back
Top