|
Hi,
I'm trying to connect MS Access Database in ASP.net using C#.
How to go about it? What will be Provider, Connection String, DSN, DataSource?
If ODBC is required, which version? Which .net DLL is to be included as reference?
Thanks,
Asawari
|
|
|
hi, I'm also doing some searching on accessing MSAcess from C# and found some links that may be helpful. I think you need OLE DB.NET provider and use ADO.NET
http://www.dotnetspider.com/qa/Question23821.aspx
here is an excerpt
public void ConnectToAccess()
{
System.Data.OleDb.OleDbConnection conn = new
System.Data.OleDb.OleDbConnection();
// TODO: Modify the connection string and include any
// additional required properties for your database.
conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
@"Data source= C:\Documents and Settings\username\" +
@"My Documents\AccessFile.mdb";
try
{
conn.Open();
// Insert code to process data.
}
catch (Exception ex)
{
MessageBox.Show("Failed to connect to data source");
}
finally
{
conn.Close();
}
}
|
|
|
Hi
thanks for your reply. But main problem was to choose appropriate provider. ie. Microsoft.Jet.OLEDB.4.0
Then we can use OleDbAdapter and code further.
Thanks,
Asawari
|
|
|
|
|
|
|
|
|
|