Page 1 of 1

Stored Proc error

Posted: Thu 14 Apr 2005 09:22
by Pascal
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

Posted: Thu 14 Apr 2005 15:10
by Ikar
Could you please translate the text of error message in English?
Please specify in what line of your code it happens.

Stored proc error

Posted: Thu 14 Apr 2005 15:19
by Pascal
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

Posted: Thu 14 Apr 2005 15:39
by Ikar
Is it possible that you use the same connection (TMSConnection) in the different threads?

Posted: Fri 15 Apr 2005 07:12
by Guest
please use PrepareSQL method before execute command.