CCADO Connection when run the job though error

static void ADOTestJob(Args _args)

{

#CCADO

CCADOConnection ccConnection;

CCADOCommand ccCommand;

CCADORecordSet ccRecordset;

CCADOFields ccFields;

str st;

str data1;

int data2;

;

ccConnection = new CCADOConnection();

// Setting the connection string

ccConnection.connectionString(StrFmt(‘Provider=SQLOLEDB.1;Persist Security Info=False;User ID=%3;Password=%4;Initial Catalog=%2;Data Source=%1’

, ‘UATServer’ // Server’s IP or name

, ‘FWSalesHistoryDB’ // Database or catalog

, ‘reddy’ // Username

, ‘Pass@word1’ // Password

));

// Open the connection

ccConnection.open();

// Preparing the query

st = “SELECT * FROM FWDailyHistorySales”;

// Recordset object creation

ccRecordset = new CCADORecordSet();

// Executing the query

ccRecordset.open( st, ccConnection);

// Reading data

while (!ccRecordset.EOF())

{

ccFields = ccRecordset.fields();

ltDailySalesDataHist.Transdate = ccFields.itemName(“TransDate”).value(); //resultSet.getDate(1);

ltDailySalesDataHist.DayOfWeek = ccFields.itemName(“Day”).value();

ltDailySalesDataHist.LocationID = ccFields.itemName(“Store”).value();

ltDailySalesDataHist.SalesAmount = ccFields.itemName(“SalesAmount”).value();

ltDailySalesDataHist.SalesCount = ccFields.itemName(“InvCount”).value();

ltDailySalesDataHist.Customer = (select DefaultCustAccount from RetailChannelTable

Where RetailChannelTable.inventLocation == ltDailySalesDataHist.LocationID).DefaultCustAccount;

ltDailySalesDataHist.insert();

// We can access fields either by name or by Index

data1 = ccFields.itemName(“FIELD1”).value();

data2 = ccFields.itemIdx(1).value();

info(strfmt(“Data %1, %2”, data1, data2));

// Read next record

ccRecordset.moveNext();

}

// Closing the connection

ccRecordset.close();

ccConnection.close();

}

error:

Variable CCADOConnection has not been declared.

Would you mind tell us a bit more? For example, are you using a version of AX that contains CCADOConnection class? And if the class doesn’t exist, what do you want to hear from us?

Current Version 6.2.1000.2473 ax 2012 R2

There is no CCADOConnection class in AX 2012, so there is no surprise that your code doesn’t compile.

Rewrite your code for AX 2012. My recommendation is using a strongly-typed (.NET) API, although you could also use ODBCConnection class in X++ (weakly-typed API) or something.

Hi you have the code or xpo please send me Email ID

email Id : reddyax2014@gmail.com

I can answer your questions but I’m not going to do your work for you (unless you pay me for that). Send me a private message if you want to discussed paid assistance with development.

If you now understand why you were getting the error, please mark the question as answered.