Having a problem with ODBC

Has anybody seen anything like this… Message: ERROR [42000] [Simba][SimbaEngine ODBC Driver]SELECT * FROM << ??? >>[G_L Account] ERROR [42000] [Simba][SimbaEngine ODBC Driver]Syntax Error.]]> It looks like the [dbo] context is missing. We have upgraded to the latest SP’s for Nav 4 and Nav 5.

What exactly are you trying to do in this instance? Are you trying to run a query? If so can you post the query that you are trying to run. The [dbo] part of a sql table refers to the schema and shouldn’t be referenced when querying your Navision database.

Here is the Query I am trying to run…

“SELECT * FROM [” + PrefixName + "$G_L Account]

(Where PrefixName is the Company).

I’m new to this Navision stuff, but It looks like this Query only works if the DB is a SQL Server database,

and will not WOrk for the NATIVE ( *.dbf) file (as accessed via ODBC).

I’ve inherited this code, and I’m wondering if there is an API here that should be in use.

Something like NAV_GetGLAccountsForCompany(…);

I’ve notices that the ODBC driver seems to be ‘smart’ and is already setup with the Company context.

Thoughts ?

Forgot to mention tha the ‘Table name’ through the ODBC dirver appears

to be [G/L Account] versus [_$G_L Account] for SQL Server.

When querying your data from ODBC, since you are not using SQL server, try using the names of the tables as they appear within Navision. At times in the database your table name be dbo.Thiscompany$Old_Items, while in Navision it will appear as [Old Items]. You just simply have to change your query accordingly:

SELECT * FROM [G/L Account]

Ok. But that means that my product needs to know whether it is talking to a Navision DB hosted on SQL server, versus a Navision DB that is Native. (i.e.: a *.dbf file).

Which Means that I will have ‘dual’ code.

Is that the only way ? Isn’t there a Navision SDK or API that would hide those detials from my code ?

I just need to get some basic stuff ( like a list of the GL accounts).

I’m not sure if there are any created, but I wouldn’t be surprised if an API has been created via Web Services or ASP.NET that does indeed do this. The question then becomes a matter of which is more convenient for you.