How to connect to MscAcess DB in ADO.NET?

Question

How to connect to MscAcess DB in ADO.NET?

Re: How to connect to MscAcess DB in ADO.NET?

Before working with a database, you have to add the OleDb .NET Data Provider namespace, by placing the following at the start of your code module:
using System.Data.OleDb;
Similarly for the SqlClient .NET Data Provider namespace:
using System.Data.SqlClient;
The using statement should be positioned first in your code.
Now, we have to declare a connection string pointing to a MS Access database "PersonDatabase.mdb".
public string
conString=@"Provider=Microsoft.Jet.OLEDB.4.0;" +
@" DataSource=..\\..\\PersonDatabase.mdb";