xsharp.eu • How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW - Page 2
Page 2 of 2

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Posted: Tue Jun 15, 2021 10:59 am
by robert
Dick,
I am not sure with which build of X# you are working.
But in the current build the tooltip and completion code show parameter 2 as this:
ads.png
ads.png (2.82 KiB) Viewed 214 times
If you look at the prototype in our source code it is written as:

Code: Select all

 PUBLIC STATIC METHOD AdsGetLastError(pulErrCode OUT DWORD, [InAttribute] [OutAttribute] strBuf AS CHAR[], pusBufLen REF WORD ) AS DWORD


The [Inattribute] and [OutAttribute] tell you that you need to pass in a buffer of type CHAR[] and that Advantage will write to this buffer.

Robert.

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Posted: Tue Jun 15, 2021 12:18 pm
by ic2
Hello Robert,

I reinstalled 2.7 but if you look in the tooltip picture you see that the tooltip/completition is exactly the same as what you post.
And if you look in the code than you see that do pass a Char[] variable.
But that gives me:
Error XS1615 Argument 2 may not be passed with the 'ref' keyword

Or are you trying to say that this error does not occur in 2.8?

In that case I'll try later when I reinstall 2.8.

Dick

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Posted: Tue Jun 15, 2021 1:13 pm
by robert
Dick,
The tooltips are different. Yours (2.7) says "REF Char[]" , 2.8 sas "AS Char[]".
This was a problem in the "tooltip" code inside VS which has been fixed in 2.8.
The compilers in 2.7 and 2.8 both want this parameter without REF prefix.

Robert

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Posted: Wed Jun 16, 2021 8:31 am
by ic2
Hello Robert,

Aaaah, I overlooked the difference. Anyhow, good to know that the compiler is doing the right thing.

One remark for future readers: I also found out why the original code returned 7200 (suggesting an error) while the record was still INSERTed. Turned out that the record had 2 email addresses totaling more than the C60 in our contact DBF. The record will be inserted with the e-mail truncated but an error is generated too.

With the current code I can both see (and log) any error but also act on the fact that the record has been added anyway.

Dick