C/ODBC v2 and C/ODBC v3

Hi, I am developping an application to access my navision database with the c/odbc. When I try it with the version 2, it works fine, but when I try to do it with the version 3, it doesn’t understand my query. here is my query : String request = "SELECT * " + "FROM “G/L Entry” " + "WHERE (“G/L Account No_” = ‘12009’) " + " AND (“Document Date” = {d ‘2001-12-31’}) " + "ORDER BY “Entry No_” "; in pure sql it would be SELECT * FROM “G/L Entry” WHERE (“G/L Account No_” = ‘12009’) AND (“Document Date” = {d ‘2001-12-12’}) ORDER BY “Entry No_” The error occurs with the format of the date. If I take out the statement of the date, it works, but when I put it back it doesnt. The error that I get is : [Navision Software a/s][Navision Attain ODBC Driver]Invalid operand for operator: = Is there a special syntax that I have to include with version 3 ? Note that with version 2, it works. I overlooked everything. Thank you ps : the account no and date are between single quote, not double quote.

Dates in ODBC are a pain but try #2001-12-31# instead of {d…} or even #20011231#. It sometimes depends on the tool you are using to create the query but microsoft likes (always allows) dates surronded by #'s. Paul Baxter

Hi Paul, it doesnt work if I put #2001-12-31# or #20011231#. I am developping in java, so I dont know if there is any other format that I can put.

I had the same type of issue with C/ODBC Version - ([Navision Software a/s][Navision Attain ODBC Driver] Invalid Operand for operator: = (#1023)). I spoke with Navision Support and they said this is an issue with MS Access. There was no additional information provided. The problem also exisits with the driver from Service Pack B.

I find it usually quite convenient to use Excel, Get External Data, for testing a SQL query. Concerning dates, this told me to use WHERE (“Posting Date”={ts ‘2001-12-31 00:00:00’}) as syntax. Note that you must use the standard SQL notation for dates (yyyy-mm-dd), and add the timepart. John Edited by - John Tegelaar on 2002 Jan 08 23:44:55

It works “Posting Date”={ts ‘2001-12-31 00:00:00’}) Thank you John

Hi, Is their a place where I can get the full documentation on this ODBC driver. I discoverd that especially the version 2 is extreeeemly picky and will crash my program. So I want to treat it gently. Marcel

Bump for Paul Smith.