Dynamics AX Read OLE DB

Source: Internet
Author: User
Tags ole

StaticSystem.Data.DataTable Getoledb_record (str _dbpath,str _query) {System.Data.OleDb.OleDbConnection oledbconnectio    N    System.Data.OleDb.OleDbCommand OleDbCommand;    System.Data.OleDb.OleDbDataAdapter OLEDBAdapter;    System.Data.DataSet DataSet;    System.Data.DataTableCollection DC;    System.Data.DataTable DT;    STR connetionstring; STR DbPath= _dbpath;//= @ "\\192.168.0.41\STARWATCH itdc PRO i\itdc-acs.mdb";str straccessselect = _query;//"SELECT Top ten * from Qrycardeventlist";str strfilter ="";    NoYes Flag;    Container C; intx, y;    STR s;    ; Straccessselect+=strfilter; Connetionstring= Strfmt ("Provider=Microsoft.Jet.OLEDB.4.0;Data source=%1;", DbPath); Try{OleDbConnection=NewSystem.Data.OleDb.OleDbConnection (connetionstring); OleDbCommand=NewSystem.Data.OleDb.OleDbCommand (straccessselect,oledbconnection); DataSet=NewSystem.Data.DataSet (); OLEDBAdapter=NewSystem.Data.OleDb.OleDbDataAdapter (OleDbCommand); Oledbconnection.open ();//info ("Connection Open! -ok ");Oledbadapter.fill (DataSet,"Dutyrecord");        Oledbconnection.close ();        Oledbconnection.dispose (); Flag=true;//info ("Connection Closed! -ok ");    }    Catch    {        if(!flag)            {Oledbconnection.close ();        Oledbconnection.dispose (); }        ThrowError"Can not open connection!"); } DC=Dataset.get_tables (); DT= Dc.get_item (0); returnDT;}

Dynamics AX Read OLE DB

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.