Wednesday, September 2, 2009

CCADOConnection Tutorial

This tutorial is helpful if you want to update another database from Dynamics AX

 

 

static void CCADO_Tutorial(Args _args)

{

    CCADOConnection     conn;

    CCADORecordSet      rst;

    CCADOCommand        cmd;

    str                 connStr, sqlStr;

    ;

 

    conn = new CCADOConnection();

    cmd = new CCADOCommand();

   

    connStr = strFmt('Provider=SQLOLEDB.1;Persist Security Info=False;User ID=%1;Password=%2;Initial Catalog=%3;Data Source=%4'

            , 'sa'  //username

            , ''  //pwd

            , 'TestDB'  //database

            , 'TESTSERVER' //server

            );

 

    conn.open(connStr);

 

    cmd.activeConnection(conn);

 

    sqlStr = "UPDATE EMPLTABLE SET EMPLID = N'NewEmplId' WHERE (EMPLID = N'OldEmplId')";

 

    cmd.commandText(sqlStr);

    cmd.execute();

 

}

Tuesday, September 1, 2009

Installing AX 2009 COM Business Connector

For those of you who need to keep using the COM Business Connector (as opposed to the new way, .NET Business Connector), AX still allows you to install this on this version. The preceding versions will no longer support COM.

To install:

{setup folder}\Setup.exe HideUI=1 AcceptLicenseTerms=1 InstallComBusinessConnector=1

Make sure that you put “AcceptLicenseTerms” not “AcceptLicense” as some code floating around suggests. Also wait a few minutes as the setup runs invisibly.

Then go to

C:\Program Files\Microsoft Dynamics AX\50\Client\Bin

Where you will find AxCom.dll (20/05/2008 2:33PM)

Oh, and don't forget to register your new dll by going to the command prompt and typing:

regsvr32 "C:\program files\microsoft dynamics ax\50\client\bin\axcom.dll"


Enjoy!