|
|
Question : Error Converting VarChar to Numeric
|
|
I am new to SQL with VB6 and I am trying to write a statement that keeps returning "Error converting VarChar to Numeric. My statement is as follows:
sSql = "SELECT dbo.ITEM_MASTER.UPC_EAN, dbo.ITEM_MASTER.DESCRIPTIVE_SIZE, " & _ "dbo.ITEM_MASTER.DESCRIPTION, dbo.ITEM_MASTER.STORE_POS_DEPARTMENT, " & _ "dbo.ITEM_MASTER.RECORD_STATUS " & _ "FROM dbo.ITEM_MASTER " & _ "WHERE dbo.ITEM_MASTER.UPC_EAN = " & txtUPC.Text & ""
dbo.ITEM_MASTER.UPC_EAN is VarChar type and txtUPC.text is a textbox filled in by the user. Any help would be appreciated.
|
Answer : Error Converting VarChar to Numeric
|
|
u have to use ' before and after txtUPC.Text. use the below code
sSql = "SELECT dbo.ITEM_MASTER.UPC_EAN, dbo.ITEM_MASTER.DESCRIPTIVE_SIZE, " & _ "dbo.ITEM_MASTER.DESCRIPTION, dbo.ITEM_MASTER.STORE_POS_DEPARTMENT, " & _ "dbo.ITEM_MASTER.RECORD_STATUS " & _ "FROM dbo.ITEM_MASTER " & _ "WHERE dbo.ITEM_MASTER.UPC_EAN = '" & txtUPC.Text & "'"
|
|
|
|
|