How can I use MS Access as a provider for ADO.NET entity framework?

前端 未结 2 1223
夕颜
夕颜 2021-01-02 06:26

Do you know to use a provider for MS Access in ADO.NET Entity Framework?

相关标签:
2条回答
  • 2021-01-02 06:46

    ADO.NET Entity Framework is designed to work with anything that as standard ADO.NET provider. Access does.

    0 讨论(0)
  • 2021-01-02 06:52

    I don't know if this will help you, but take it for what it is worth. Following is my connection string in C# to connect to a MS-Access database.

    I have a strongly typed dataset that I put the data into and them manipulate it there. Use the System.Data.OleDb namespace.

    sourceString = "\\\DatabaseServer\DatabaseFolder\database.mdb";
    
    conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sourceString;
    string strSql1 = "SELECT * FROM IDTable";
    OleDbConnection con = new OleDbConnection(conString);
    
    currentDataSet.IDTable.Rows.Clear();
    con.Open();
    OleDbDataAdapter dAdapter = new OleDbDataAdapter();
    dAdapter.SelectCommand = new OleDbCommand(strSql1, con);
    dAdapter.Fill(currentDataSet, "IDTable");
    con.Close();
    
    0 讨论(0)
提交回复
热议问题