.NET ODBC SQL Syntax

Hello, Im writing a webapplication for collecting data from nav 3.6 native. Im using vs2005 for this. Problem is the syntax for sql query.

This is ok and returns all rows:
navOdbcCommand.CommandText = “SELECT Sales_Header.No_ FROM Sales_Header”;

This is also ok but generates runtimerror:
navOdbcCommand.CommandText = “SELECT Sell-to_Customer_No_ FROM Sales_Header”;
ERROR [42S00] [Navision a/s][Navision Attain ODBC Driver]Column not found: Sell

How can i correct the syntax. My ODBC connection is All except spaces Regards Tomas

Try this: “SELECT [Sell-to_Customer_No_] FROM Sales_Header” or change the settings for identifiers in the odbc soucre to “All except…”

/Lars

Hello again,

Now I have hade time to test it. Anyway, I get error when I try your syntax both with all except spaces and all except dots

“SELECT [Sell-to_Customer_No_] FROM Sales_Header”

ERROR [08004] [Navision a/s][Navision Attain ODBC Driver]Data source rejected establishment of connection

// Tomas

ODBC Driver has the same version has database server?
User has navision permissions to connect to database thought ODBC?

How can I check ODBC driver version?

Version is 3.60.00.11353