Options

The Automation Variable has not been instantiated.

Hello,

I am trying to use the automation control to retrieve data from a database as per the following codes:
I am able to compile the code successfully but when running the page, I am getting the error: The Automation Variable has not been instantiated.

Version : NAV 2013 R2.


ConnectionString := 'PROVIDER=SQLOLEDB;SERVER=' + ServerName + ';DATABASE='+DatabaseName+';UID='+USER+';PWD='+Password;

IF ISCLEAR(ADOConnection) THEN BEGIN
IF NOT CREATE(ADOConnection,FALSE,TRUE) THEN BEGIN
ERROR('Cannot create ADO Connection automation variable');
END;
END;

IF ISCLEAR(ADORecordSet) THEN BEGIN
IF NOT CREATE(ADORecordSet,FALSE,TRUE) THEN BEGIN
ERROR('Cannot create ADO Recordset automation variable');
END;
END;

ADOConnection.ConnectionString(ConnectionString);
ADOConnection.Open;


While debugging the code is breaking at IF NOT CREATE(ADOConnection,FALSE,TRUE) THEN BEGIN

Can you please help.

Thanks
Bhavna

Answers

  • Options
    Wisa123Wisa123 Member Posts: 308
    Before i actually look at this closely:
    Why dont you use dotnet? I know its a habit to go back to the automation stuff we already know, but from 2013R2 forward there is no reason to use automations anymore.
    Austrian NAV/BC Dev
  • Options
    BhavnaBeedaseeBhavnaBeedasee Member Posts: 5
    Thanks for your reply. I will have to do some R&D as I am not a .NET expert.

    My objective is to read data from an external SQL database and insert in Navision Tables. How am I going to achieve this using .NET???
Sign In or Register to comment.