Options

Cannot read Navision db from Navision using ADO

Lars_WestmanLars_Westman Member Posts: 116
I want to read a SQL db from Navision using ADO. The db is the same db as the Navision client is connected to. The reason for this is to overcome the versioning principle.

The background for this is that I have a "Master NAS" that starts and stops several other NAS-services. So both the master NAS and the "Slave-NAS" will update the same company-shared table in Navision (a table containing information about NAS-services. It is the master NAS that must read the shared table with ADO to see if a slave is finished (indicated by updating a field in the table) with the execution. We do this because we only want to have max 2 NAS running at the same time. Of course it's a license issue.

The problem is that NAS #1 updates a row with a start time and then waits for NAS #2 to update the same row with a stop time. When that happens NAS #1 stops NAS #2 and then the same thing happens with NAS #3 and so on. SELECTCURRENTVERSION does not seem to help. That is why I went down the ADO-track.

I have no problem working with with the Northwind db from within Navision using ADO. But when I try to access the Navision db a don't get any data in return. I can open the recordset, but I cant MoveFirst or something like that.

It seems to be a permission issue, but the same user can access the Navision db with Query Analyzer.

Here's some code

ConnStr := 'Provider=sqloledb;data source=dbsqlnav;database=Navision;Integrated Security=SSPI;';
CREATE(ADOConn);
ADOConn.Open(ConnStr);
CREATE(ADORst);
ADORst.Open('Select * from AppServers',ADOConn,2,3);
ADORst.MoveFirst; (This is where it stops)

But this works fine:

ConnStr := 'Provider=sqloledb;data source=dbsqlnav;database=Northwind;Integrated Security=SSPI;';
CREATE(ADOConn);
ADOConn.Open(ConnStr);
CREATE(ADORst);
ADORst.Open('Select * from Orders',ADOConn,2,3);
ADORst.MoveFirst;

If I make a copy of the table by creating it from Query Analyzer it works grate. It's just the tables created from within Navisions that is a problem.

I'm stuck ](*,)
Sign In or Register to comment.