Jet Rep Object. ( change password)

G

Guest

I get an "Could not find installable ISAM." But the error does not make
sense. to me. I converted this code to C# that I found on the internet:
( http://www.vbcity.com/forums/faq.asp?fid=8&cat=MS Access#TID42009 )
What might be wrong ?
I have a reference to msjro.dll version 2.81.1117.0 which show up as
interop.jro in my references.
THE FUNCTION:
public bool changePassword(string SourceDB,string DestDB,string
OldPswd,string NewPswd)
{
bool retval=false;
string SourceCNN;
string DestCNN;

JRO.JetEngine jro = new JRO.JetEngine();

// delete the backupfile if exists
try
{
if (File.Exists(DestDB)==true)
{ File.Delete(DestDB);}
// Build the connection strings
SourceCNN="Provider=Microsoft.Jet.OLEDB.4.0" + ";Data Source=" + SourceDB +
";Jet OLEDBatabase Password=" + OldPswd;
DestCNN="Provider=Microsoft.Jet.OLEDB.4.0" + ";Data Source=" + DestDB +
";Jet OLEDBatabase Password=" + NewPswd;
// Create the replica with the new password
jro.CompactDatabase(SourceCNN,DestCNN);
// overwrite the old one with the new one and delete the temp.
File.Delete(SourceDB);
File.Copy(DestDB,SourceDB,true);
File.Delete(DestDB);
retval=true;
}
catch( Exception e )
{
Console.WriteLine(e.Message);
}
return retval;
}
 
G

Guest

The connection strings were misspelled: should have been:
// Build the connection strings
SourceCNN="Provider=Microsoft.Jet.OLEDB.4.0" + "; Data Source=" +
SourceDB + "; Jet OLEDB:Database Password=" + OldPswd;
DestCNN="Provider=Microsoft.Jet.OLEDB.4.0" + "; Data Source=" + DestDB +
"; Jet OLEDB:Database Password=" + NewPswd;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top