G
Guest
The following function fails if the Jet database has a password. This is the
error:
{"Cannot start your application. The workgroup information file is missing
or opened exclusively by another user." }
However the same Jet database opens easily with VB 6. Thereis no MDW (
workgroup file - never has been. ). So what is happening: ??
public bool testOpenJet( string strDbPath, string pwd)
{
try
{
string sCnnString= "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=";
System.Data.OleDb.OleDbConnection jetConn = new OleDbConnection();
sCnnString+= sCnnString + strDbPath;
if (pwd.Length>0)
{
sCnnString+= ";Password="+ pwd;
}
jetConn.ConnectionString=sCnnString;
jetConn.Open();
jetConn.Close();
return true;
}
catch ( Exception e)
{
Console.WriteLine(e.Message);
}
return false;
}
VB 6 CODE:
Private Sub Form_Load()
Dim db As DAO.Database
Dim AccessPath As String
Dim dbPassword As String
dbPassword = "test"
AccessPath = "c:\password.mdb"
Set db = OpenDatabase(AccessPath, False, False, ";pwd=" & dbPassword)
End Sub
error:
{"Cannot start your application. The workgroup information file is missing
or opened exclusively by another user." }
However the same Jet database opens easily with VB 6. Thereis no MDW (
workgroup file - never has been. ). So what is happening: ??
public bool testOpenJet( string strDbPath, string pwd)
{
try
{
string sCnnString= "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=";
System.Data.OleDb.OleDbConnection jetConn = new OleDbConnection();
sCnnString+= sCnnString + strDbPath;
if (pwd.Length>0)
{
sCnnString+= ";Password="+ pwd;
}
jetConn.ConnectionString=sCnnString;
jetConn.Open();
jetConn.Close();
return true;
}
catch ( Exception e)
{
Console.WriteLine(e.Message);
}
return false;
}
VB 6 CODE:
Private Sub Form_Load()
Dim db As DAO.Database
Dim AccessPath As String
Dim dbPassword As String
dbPassword = "test"
AccessPath = "c:\password.mdb"
Set db = OpenDatabase(AccessPath, False, False, ";pwd=" & dbPassword)
End Sub