I work on an application that call a function from a DLL
the Code :
Code: Select all
Procedure CalcCDE(c : TMyConnection;nt : string ); stdcall ;
{ c : will be the Application Connection}
var
tCn : TMyConnection ;
begin
try
tCn := TMyConnection.Create(nil);
tCn.Username := c.Username;
tCn.Password := c.Password;
tCn.Server := c.Server;
tCn.Port := c.Port;
tCn.Database := c.Database;
// tCn.Connect;
except on E:Exception do
ShowMessage('0 : ' + E.Message);
end;
{ Dm.c_Cde : is TMyCommand in Datamodule in DLL Projects}
try
Dm.c_Cde.Connection := tCn;
tCn.Connect;
except on E:Exception do
begin
ShowMessage('1 : ' + E.Message);
tCn.Close;
tCn.Free;
end;
end;
{ ==============================}
{ try to full parameters of DataSets }
{ Dm.c_Cde : is TMyCommand in Datamodule }
{==============================}
try
Dm.c_Cde.ParamByName('a').AsString := nt;
Dm.c_Cde.ParamByName('b').AsString := nt;
Dm.c_Cde.ParamByName('c').AsString := nt;
Dm.c_Cde.ParamByName('d').AsString := nt;
except on E:Exception do
begin
ShowMessage('2 : ' + E.Message);
tCn.Close;
tCn.Free;
end;
end;
{ ======================== }
{ Executing the Querys & .. ...}
{ ========================}
try
Dm.c_Cde.Execute;
except on E:Exception do
begin
ShowMessage('3 : ' + E.Message);
tCn.Close;
tCn.Free;
end;
end;
{ =========================}
{ Free Allocated ressources ...}
{ ==========================}
tCn.Close;
tCn.Free;
end;
{ ==========================}
{ Exported Functions }
{===========================}
EXPORTS CalcCDE;
Code: Select all
procedure TDm.DCdeAfterPost(DataSet: TDataSet);
var
t : String;
begin
t :=CdebsCdCde.Value;
CalcCDE(MyCnt,t);
end;
I Use Delphi 5 + MyDac 4.40.25
Please help me !
thanks u