[Compilation Error] Codeunit that uses ADO and VARIANT.

Sl1m4erSl1m4er Member Posts: 42
Hi all,

I have a codeunit that works with an SQL db stored at the same SQL server as the NAV db, using ADO connections.
Everything is working great, but there is an annoying compilation error that appears only when I try to compile the codeunit the first time I open the NAV db, then when I recompile (sometimes I have to do it several times) - it disappears.
Should I reopen the NAV db - and the error is there again.

The code that triggers an error:
ADOCommand.ActiveConnection := varADOActiveConnection;
Name                     DataType    Subtype	
- ADOCommand	            Automation  'Microsoft ActiveX Data Objects 2.8 Library'.Command	
- varADOActiveConnection   Variant

The error message is as follows:
This message is for C/AL programmers:

This data type is not supported by C/SIDE. You can access data from
any of the following data types:
VT_VOID, VT_I2, VT_I4, VT_R4, VT_R8, VT_CY, VT_DATE, VT_BSTR and VT_BOOL

So the question is - what is the reasoning behind such compiler behavior? And is there any way to avoid such compilation error?

Thanks in advance.

Comments

  • ara3nara3n Member Posts: 9,256
    It's a bug,

    what I had to do if I remember correctly was set the adocommand to be a local variable.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Sl1m4erSl1m4er Member Posts: 42
    ara3n wrote:
    It's a bug,

    what I had to do if I remember correctly was set the adocommand to be a local variable.

    Thanks for your reply, ara3n.In my case, both variables are local.

    I need to provide some information to the testing vendor - why does this compilation error appear, at least in some general terms, but I don't know what to reply :-k
  • ara3nara3n Member Posts: 9,256
    you can try with newer exe and see if you still get the error.
    NAV is getting confused with COM datatype by the ADO automation.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • krikikriki Member, Moderator Posts: 9,110
    [Topic moved from 'NAV Three Tier' forum to 'NAV/Navision Classic Client' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.