XSharpPublic icon indicating copy to clipboard operation
XSharpPublic copied to clipboard

Error when debugging and executing SQL queries with the AdsSQLServer object

Open christianschmid200272 opened this issue 1 year ago • 1 comments

I am reporting two problems here which may have the same cause.

We use AdsSQLServer, the SQL queries used in it are formed via joins over several tables. The original problem was that if such a SQL statement over multiple tables does not return any data, the bBrowser does not update anymore and if you select a record it crashes. "Error 5018: The handle given was not recognized by Advantage. Verify specified handle is open/active. The given handle is not recognized as a valid Advantage Client Engine handle." If you remove the joins from the SQL, there are no problems.

When trying to debug the first error, I come to the second problem. If you try to debug a variable of type AdsSQLServer in e.g. Visual Studio, to display the properties in the WatchWindow, you get the following error for objects that contain an SQL with Jons: "Error 5054: The command cannot be completed with the current user permissions. Unable to get file information for ADTs with rights checking off.;-2146233088;". The behavior here is also such that if the joins are removed from the SQL, the objects can be debugged.

XSharp Version 2.19.0.2

Demo App FUNCTION Start() AS VOID STRICT ? "Hello World! Today is ",Today() LOCAL oDB AS AdsSQLServer LOCAL dwRet AS DWORD LOCAL hConn AS System.IntPtr

dwRet := AdsConnect60( "\myserver\myshare", XSharp.ADS.ACE.ADS_REMOTE_SERVER, NULL_PSZ, NULL_PSZ, 0, OUT hConn ) AX_SetConnectionHandle( hConn ) /* Create Testtables

CREATE TABLE table1 ( field1 CHAR(10), field2 INTEGER ); CREATE TABLE table2 ( field1 CHAR(10), field2 INTEGER, t2field2 INTEGER ); insert into table1 values ('T1', 1); insert into table2 values ('T2', 2, 1); */

//Returns an error when I try to check the properties of oDB in the debugger watchwindow. I am using Visual Studio. oDB := AdsSQLServer{"SELECT table1.field1 FROM table1 inner join table2 on table2.t2field2 = table1.field2 WHERE table1.field2 = 1 ", , , "AXSQLCDX", ,} //The properties of these two statements without the inner join can be easily analyzed in the debugger. //oDB := AdsSQLServer{"SELECT table1.field1 FROM table1 WHERE table1.field2 = 1 ", , , "AXSQLCDX", ,} //oDB := AdsSQLServer{"SELECT * FROM table2 WHERE table2.field2 = 1 ", , , "AXSQLCDX", ,}

oDB:Close() WAIT RETURN

christianschmid200272 avatar Apr 26 '24 09:04 christianschmid200272

One more note, all SQL queries are correct and were also tested via the data architect. The applications with the same code run in VO without errors. In the development environment an ADS server version 12 is used, in the production environment version 11, the error occurs in both systems.

christianschmid200272 avatar Apr 29 '24 05:04 christianschmid200272