i am having real issues trying to build a sql string

Dim SelectQry = "SELECT * FROM TblSupplierQuotes where TenderNo='" & Me.txtTenderRef.Text & "' AND KMBPartNo=" & " " & Me.lbKMBPartNo.Text & " "

in SQL the TenderNo is varchar(50) = L003141T75-2012JANTEN
KMBPartNO is text = 442 019 115 1

when i run this command i get the error Incorrect syntax near '019'.

what am i doing wrong??

Recommended Answers

All 3 Replies

You have no Single quotes around KMBPartNo

Dim SelectQry = "SELECT * FROM TblSupplierQuotes where TenderNo='" & Me.txtTenderRef.Text & "' AND KMBPartNo='" & Me.lbKMBPartNo.Text & "';"

when ever you find this type of error ,please type your query in management studio it will help you to find errors ,

Regards

mycommand.CommandText can also help u to return the entire query.....in ur debug.print.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.