13.05.2007, 17:12 | #1 |
Участник
|
casperkamal: Using ADO to read from Excel in Microsoft Dynamics Ax
Источник: http://casperkamal.spaces.live.com/B...CD63!288.entry
============== Sometime back i had a posting referring to Gloomies blog (click to see the old posting) on using ADO in Ax. Gloomie had used COM based ADO control. Ax also has predefined ADO Com classes which you can use.... Here's a small Job that will help you in working with the Inbuild ADO classes static void JobADOtoAccessExcelInAxapta(Args _args) { CCADOConnection adoexcel = new CCADOConnection(); CCAdoxCatalog adoCatalog = new CCAdoxCatalog(); COM adoxCatalog = new COM('ADOX.Catalog'); CCADORecordSet adoRecordSet = new CCADORecordSet(); CCADOFields adoFields; CCADOField adoField; int i; ; adoexcel.connectionString("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\TestAdo.xls ;Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"); adoexcel.open(); adoxCatalog.activeConnection(adoexcel.connection()); adoCatalog.adoxCatalog(adoxCatalog); print adoCatalog.tableName(1); pause; adoRecordSet.open(@"SELECT * FROM [SHEET1$]", adoexcel); adoFields = adoRecordSet.fields(); for (i = 0; i < adoFields.count(); i++) { adoField = adoFields.itemIdx(i); print adoField.name(); pause; } while (! adoRecordSet.EOF()) { for (i = 0; i < adoFields.count(); i++) { adoField = adoFields.itemIdx(i); print adoField.value(); pause; } adoRecordSet.moveNext(); } } Here is a snap shot of the excel that i used for the job.... .................. Keep watching while I post more on this ... Источник: http://casperkamal.spaces.live.com/B...CD63!288.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|