How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

This forum is meant for questions and discussions about the X# language and tools
User avatar
robert
Posts: 4326
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Post 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 138 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.
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1818
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Post 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
User avatar
robert
Posts: 4326
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1818
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

How to check if creation of DBF record succeeded using AdsExecuteSQLDirectW

Post 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
Post Reply