开发者

Can I open a MS access mdb file on CD with Delphi

开发者 https://www.devze.com 2023-03-08 15:56 出处:网络
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.

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消