Can not open a Resultset

Forum related to MS SQL Server

Moderators: gto, cipto_kh, EgonHugeist

Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 18.01.2010, 16:48

Can not open a Resultset

Postby fredycc » 06.04.2010, 22:49

Hi boys I have a problem with Zeos 6.6.6-stable & FPC 2.2.4(windows 7) & SQL server 2005; I have created a SP like this:
//Is a simple SP to return a integer
ALTER PROCEDURE [dbo].[BuscaTarCta](
@Tar VARCHAR(18),
@Cta VARCHAR(18),
@Res Integer OUTPUT )


Select @Res = COUNT(SM.NumTar) From tMKStockMon SM
Where SM.NumTar = @Tar And SM.NumCuenta = @Cta

The problem is when I try to execute the SP into my application, I did this:

ZStoredProc2.StoredProcName := 'BuscaTarCta';
ZStoredProc2.ParamByName('@Res').ParamType := ptOutput;
ZStoredProc2.ParamByName('@Tar').ParamType := ptInput;
ZStoredProc2.ParamByName('@Cta').ParamType := ptInput;

ZStoredProc2.ParamByName('@Tar').Value:= StringGrid3.Cells[2,i];
ZStoredProc2.ParamByName('@Cta').Value := StringGrid3.Cells[3,i];


When the application try to execute with: ZStoredProc2.Open; launch a message error: Can not open a Resultset.

I have tried using ExecProc but When I try to obtain the value, a error message appear: Field @Res not found. :(

Fresh Boarder
Fresh Boarder
Posts: 14
Joined: 18.01.2010, 16:48


Postby fredycc » 06.04.2010, 23:56

I found the solution, my mistake is my sp, I modify it and works. :oops:

Return to “MS SQL Server”

Who is online

Users browsing this forum: No registered users and 1 guest