Hello.
I'm using Unidac 3.50 with delphi 7.
I need to execute a stored procedure in SQL Server and get the returned value (int).
Any tips on how to do this? I tried with Tuniquery and TUniStoredProc with no sucess.
Thanks in advance.
Regards
Goncalo
How to get result value from SQL Procedure
-
AndreyZ
Re: How to get result value from SQL Procedure
Hello,
Here is a code example:, where AddInts is the following stored procedure:
Here is a code example:
Code: Select all
UniStoredProc1.StoredProcName := 'AddInts';
UniStoredProc1.PrepareSQL;
UniStoredProc1.ParamByName('int1').AsInteger := 1;
UniStoredProc1.ParamByName('int2').AsInteger := 3;
UniStoredProc1.Execute;
ShowMessage(IntToStr(UniStoredProc1.ParamByName('res').AsInteger));
Code: Select all
CREATE PROCEDURE AddInts
@int1 INT,
@int2 INT,
@res INT OUT
AS
BEGIN
SET @res = @int1 + @int2;
END