views:

3960

answers:

2

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

+1  A: 

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

AnthonyWJones
when i add ADO.NET Entity Data Model to project,i see 3 Providers(All of them are Microsoft Sql Server Drivers)Should i add a referance for it?
The designer in VS only supports SQL Server when it comes to building an initial entity set, for Access you will need to use the OLE DB provider and build the entity set the hard way. Sadly that is literally the hard way. My suggestion would be use SQL 2008 Express instead.
AnthonyWJones
Thank you Anthony
A: 

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();
Matt
How did this get voted up? It is irrelevant to the question at hand. EF is completely different from using DataSets and DataAdapters (ewww, gross).
Mateo