X
-xx-
Hi,
I am new to c# and just trying out c# with ms access. First problem i
encountered is how do i open up ms access that has password.
Here is my current codes which working fine if there is no password on ms
access:
//Specify sql server-specific connection string
private const string strdns = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=f:\sample1.mdb";
//Main connector
public OleDbConnection thisconnection;
public clsDBBasic()
{
//Open the database
try
{
thisconnection = new OleDbConnection(strdns);
thisconnection.Open();
}
catch
{
throw new Exception("Open data error.");
}
}
Can anyone please tell me how to open ms access with password protected? I
have tried change the STRDNS variabale to
private const string strdns = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=f:\sample1.mdb;ID=sa;PWD=abc123;Persist Security Info=true"; //Not
working
private const string strdns = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=f:\sample1.mdb;OLEDB Password=abc123"; //Not working
I am new to c# and just trying out c# with ms access. First problem i
encountered is how do i open up ms access that has password.
Here is my current codes which working fine if there is no password on ms
access:
//Specify sql server-specific connection string
private const string strdns = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=f:\sample1.mdb";
//Main connector
public OleDbConnection thisconnection;
public clsDBBasic()
{
//Open the database
try
{
thisconnection = new OleDbConnection(strdns);
thisconnection.Open();
}
catch
{
throw new Exception("Open data error.");
}
}
Can anyone please tell me how to open ms access with password protected? I
have tried change the STRDNS variabale to
private const string strdns = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=f:\sample1.mdb;ID=sa;PWD=abc123;Persist Security Info=true"; //Not
working
private const string strdns = @"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=f:\sample1.mdb;OLEDB Password=abc123"; //Not working