0

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??

4
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by poojavb
1

You have no Single quotes around KMBPartNo

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

Edited by kRod: Added Code

0

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

Regards

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.