Select from a access table

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • frank

    Select from a access table

    I am looking for a way to select some data from a Access database into my
    SQL database.

    In Enterprise manager, I want to do someting like:

    SELECT InvoiceNo, CID
    FROM c:\MyAccessData base.mdb\CIDTab le
    WHERE Imported=0


  • Plamen Ratchev

    #2
    Re: Select from a access table

    Create a linked server using the OLE DB Provider for Jet and then you can
    query all Access tables:


    HTH,

    Plamen Ratchev


    Comment

    • Kevin Zhong

      #3
      Re: Select from a access table

      On Jun 13, 6:35 am, "frank" <frank...@onlin e.nowrote:
      I am looking for a way to select some data from a Access database into my
      SQL database.
      >
      In Enterprise manager, I want to do someting like:
      >
      SELECT InvoiceNo, CID
      FROM c:\MyAccessData base.mdb\CIDTab le
      WHERE Imported=0
      you must create a connection instance at first.

      code following:
      System.Data.Ole Db.OleDbConnect ion conn=new
      System.Data.Ole Db.OleDbConnect ion("Provider=x xxx;datasource= c:
      \MyAccessDataba se.mdb;");
      System.Data.Ole Db.OleDbCommand cmd=new
      System.Data.Ole Db.OleDbCommand ("SELECT InvoiceNo, CID FROM
      CIDTable",conn) ;

      System.Data.Ole Db.OleDbDataAda pter ada=new
      System.Data.Ole Db.OleDbDataAda pter(cmd);
      DataTable dt=new DataTable();
      ada.Fill(dt);


      ok.
      the data in DataTable object.

      Comment

      Working...