unit UnDM;
interface
uses
SysUtils, Classes, DB, ADODB;
type
TDM_Tax = class(TDataModule)
ADOCon_Tax: TADOConnection;
ADOQry_Tax: TADOQuery;
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
DM_Tax: TDM_Tax;
implementation
uses IniFiles, Un_TaxMain;
{$R *.dfm}
procedure TDM_Tax.DataModuleCreate(Sender: TObject);
var
ConnStr,provider,password,userid,datasource,initcatalog:String;
inifilename:String;
inifile:TInifile;
begin
inifilename := ExtractFilePath(paramstr(0))+'db.ini';
inifile := TInifile.Create(inifilename);
provider := inifile.ReadString('Database','Provider','SQLOLEDB.1');
userid := inifile.ReadString('Database','User ID','sa');
password := inifile.ReadString('Database','Password','sa');
datasource := inifile.ReadString('Database','Data Source','127.0.0.1');
initcatalog := inifile.ReadString('Database','Initial Catalog','tax');
ConnStr := 'Provider='+provider+';Password='+password+';Persist Security Info=True;User ID='+userid+';Data Source='+datasource+';Initial Catalog='+initcatalog;
inifile.Destroy;
ADOCon_Tax.ConnectionString := ConnStr;
try
ADOCon_Tax.Connected;
except
exit;
end;
end;
end.