1

I am trying to connect to an Access DB using odbcConnection through ConnectionString in Properties menu in VS C# 2010 Express version. I get an error that tells me this option isn't enable in Express edition and I am forced to use other versions or code.

How I can use code for do this connection?

1

1 Answer 1

5
using System.Data.Odbc;

using(OdbcConnection myConnection = new OdbcConnection())
{
    var myConnectionString = @"Driver={Microsoft Access Driver (*.mdb)};" + 
        "Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;";
    myConnection.ConnectionString = myConnectionString;
    myConnection.Open();

    //execute queries, etc
}

See ConnectionStrings

Reproduced from here.

Sign up to request clarification or add additional context in comments.

1 Comment

Q+1, A+1, Thank god, there are answers that give me exactly what I need.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.