Stored Proc error

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Pascal
Posts: 2
Joined: Thu 14 Apr 2005 09:15

Stored Proc error

Post by Pascal » Thu 14 Apr 2005 09:22

I use the following function to run a stored proc :

function ExecSp(ProcName : string; InParamsValues: Variant) : Variant;
var
Id : integer;
begin
Result:=Null;

with DM_B.MSStoredProc do
begin
while Executing do
Application.ProcessMessages;

if Prepared then
UnPrepare;

Params.Clear;

Close;
StoredProcName:=ProcName;


// initialiser les parametres en entrée
for Id:=0 to Params.Count-2 do
Params[Id + 1].Value:=InParamsValues[Id];

try
Prepare;
ExecProc;

Result:=Params[0].Value;
finally
if Prepared then
UnPrepare;

Close;
Params.Clear;
StoredProcName:='';
end;
end;
end;

Sommetimes when I call the function
I have the error message " Le connexion est utilisée par les resultat d'une autre commande"

What does it mean ??

Pascal

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 14 Apr 2005 15:10

Could you please translate the text of error message in English?
Please specify in what line of your code it happens.

Pascal
Posts: 2
Joined: Thu 14 Apr 2005 09:15

Stored proc error

Post by Pascal » Thu 14 Apr 2005 15:19

Ikar wrote:Could you please translate the text of error message in English?
Please specify in what line of your code it happens.
"Connection is busy with results for another hstmt."

This error append sometimes only, and I don't know wich statement produce it

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 14 Apr 2005 15:39

Is it possible that you use the same connection (TMSConnection) in the different threads?

Guest

Post by Guest » Fri 15 Apr 2005 07:12

please use PrepareSQL method before execute command.

Post Reply