Showing posts with label ADO connection string in Axapta. Show all posts
Showing posts with label ADO connection string in Axapta. Show all posts

Friday 7 September 2012

ADO connection string in Axapta

To do the Integration Job in Microsoft Dynamics Axapta use following Connection string


Create a JOB in Axapta and do the follwing

CCADOCommand         command;

CCADOCRecordSet       recordseta;

CCADOFields                Fields1;

Com                                Coms;

Str                                   Sql;

Str                                   Provider = "192.x.x.x";   // enter here your public ip address of the database server

Str                                   DataBase = "mydatabasename"; //enter here your sql database name

Str                                   UserID = "Myname";  // enter here sql user name like SA etc..

Str                                   PWD = "mypw"; //enter here your sql password

Str                                   ConnectionString = strfmt("Provider=SqlOledb;server="+ Provider + ";trusted_Connection=false;" + "Initial catalog=" + DataBase + ";User id=" + userid + ";password='" + PWD + "';");

sql = "select * from emp";

Connection = new CCADOConnection();

Connection.open(CCADOConnection);

command = new CCADOConnection();

command.commandText(sql);

recordseta = new CCADOConnection();

recordseta = command.execute();

Coms = recordseta.recordset;

if (!recordseta.EOF())

{

//here you can do your further work

}