0% found this document useful (0 votes)
11 views2 pages

Connection Code

Uploaded by

osanabakaing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

Connection Code

Uploaded by

osanabakaing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

unit dmHouses_u;

interface

uses
[Link], [Link],ADODB,DB;

type
TdmHouses = class(TDataModule)
procedure DataModuleCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
connDB: TAdoConnection;

tblProperties: TADOTable;
dsrProperties: TDataSource;

tblClients: TADOTable;
dsrClients: TDataSource;

tblAgents: TADOTable;
dsrAgents: TDataSource;

qryHouse: TADOQuery;
dsrQryHouse: TDataSource;
end;

var
dmHouses: TdmHouses;

implementation

{%CLASSGROUP '[Link]'}

{$R *.dfm}

procedure [Link](Sender: TObject);


begin
//Instantiate or create the componenets on the datamodule
connDB:= [Link](dmHouses);

tblProperties:= [Link](dmHouses);
dsrProperties:= [Link](dmHouses);

tblClients:= [Link](dmHouses);
dsrClients:= [Link](dmHouses);

tblAgents:= [Link](dmHouses);
dsrAgents:= [Link](dmHouses);

qryHouse:= [Link](dmHouses);
dsrQryHouse:= [Link](dmHouses);

//Connection code to Database


[Link] :=
'Provider=[Link].4.0;Data Source=' +
ExtractFilePath(ParamStr(0)) + '[Link]' +
'; Persist Security Info=False';
[Link] := False;
[Link];

//Linking database tables


[Link] := connDB;
[Link] := 'tblProperties';
[Link] := connDB;
[Link] := 'tblClients';
[Link] := connDB;
[Link] := 'tblAgents';

//linking the datasource


[Link] := tblProperties;
[Link] := tblClients;
[Link] := tblAgents;

//linking SQL with Database


//NOTE- you only need ONE query object to use with all the sqls
[Link] := connDB;
[Link] := qryHouse;

//Opening tables
[Link];
[Link];
[Link];
end;

end.

You might also like