Due to the MS Access database file generating a .ldb lock file when the .mdb file is open I get error trying running a Delphi application on CD where the database file also is on the CD.
Is there any solution for 开发者_如何学运维this problem?
Yes. You need to specify that you're opening the database in read-only mode. You didn't specify how you are opening the Access database, but for example, if you were using the ADODB COM objects, you would do something like this your your ADODB Connection object:
conn.Provider := 'Microsoft.Jet.Oledb.4.0';
conn.Mode := adShareDenyWrite;
conn.Open('database.mdb');
Or within the connection string itself:
conn.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;' +
'Data Source=database.mdb;' +
'Mode=Share Deny Write';
conn.Open;
精彩评论