Created
April 18, 2012 12:51
-
-
Save YoukaiCat/2413392 to your computer and use it in GitHub Desktop.
Runtime connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Returns a full path to the current dir | |
function currentDirPath():String; | |
begin | |
result:=extractFileDir(expandFileName('anything')); | |
end; | |
// Makes connection string at runtime. | |
// it's necessary because delphi don't understand relative paths. | |
procedure TDataModule.ADOConnectionBeforeConnect(Sender: TObject); | |
begin | |
ADOConnection.ConnectionString:='Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=' + currentDirPath() + | |
'\db\Library.mdb;Mode=Share Deny None;Extended Properties="";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";' + | |
'Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;' + | |
'Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don''t Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False'; | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment