Error on AS400 query call

Hi all. I have an app that is calling a query to our AS400 and pulling information back. We are in the process of writing new programs on the AS400, causing the our invoice number to now have a dash in it (112378-08 for example).

My select statement is as follows.

cm.CommandText = “select OSHTITEM from olydbf.TRACKSHIP where OSHTTRKNUM = ? AND INVOICE =” & thisDoc.GetItemValue(“Invoice”)(0)

This worked fine before the dash was put in the number. I’ve tried changing the Invoice number to a string in the statement and the Invoice field in the notes document is a text field (has been the whole time). What am I missing?

Thanks.

Subject: Solved

Even though I had tried single quotes earlier, I was missing the space. Correct syntax is as follows:

cm.CommandText = “select OSHTITEM from olydbf.TRACKSHIP where OSHTTRKNUM = ? AND INVOICE = '” & thisDoc.GetItemValue(“Invoice”)(0) &“'”

Hope this helps someone in the future.