Can I open the MSd MSdb file on a CD with Delphi

Due to the MS Access database file that creates the .ldb lock file when opening the .mdb file, I get an error when I try to run the Delphi application on the CD, where the database file is also on the CD.

Is there any solution to this problem?

+5
source share
1 answer

Yes. You need to indicate that you are opening the database in read-only mode. You did not specify how you open the Access database, but, for example, if you use ADODB COM objects, you would do something like this of your ADODB Connection object:

    conn.Provider := 'Microsoft.Jet.Oledb.4.0';
    conn.Mode := adShareDenyWrite;
    conn.Open('database.mdb');

Or inside the connection string itself:

    conn.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;' + 
        'Data Source=database.mdb;' +
        'Mode=Share Deny Write';
    conn.Open;
+14
source

All Articles