VB Database odbc connection and SQL question

My current sql looks like:
Dim invoiceheaderadapter As New Odbc.OdbcDataAdapter("select * from Copinvheaderfile where invhdrinvoicedate  = " & CurrentOrderDate.Text, testconnection)

I want to change it to the following where the wsdonotsend field is = N.
        'Dim invoiceheaderadapter As New Odbc.OdbcDataAdapter("select * from Copinvheaderfile where invhdrinvoicedate  = " & CurrentOrderDate.Text & " and InvHdrDoNotSendInvoice = " & wsdonotsendinv, testconnection)

This keeps telling me that the field 'n' does not exist.  I even placed it on my screen and made it a .text and placed an N in it.  I got the same results.  I tried with an 'n' directly in the sql also.  When it comes time to load the datatable is when it fails with the field N message.  What am I doing wrong?
MGaffAsked:
Who is Participating?
 
gamarrojgqCommented:
Hi,

You have to add single quotes to the N since is a string otherwise the compiler will treat the N lika a column, so your sql will be

Dim invoiceheaderadapter As New Odbc.OdbcDataAdapter("select * from Copinvheaderfile where invhdrinvoicedate  = " & CurrentOrderDate.Text & " and InvHdrDoNotSendInvoice = '" & wsdonotsendinv & "'", testconnection)

0
 
MGaffAuthor Commented:
Oh nuts....forgot about the single quote thing.  Thanks,
0
 
gamarrojgqCommented:
ok, great, don't forget to accept the solution
0
 
DhaestCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.