MySQL ZStoreProc error

The stable tester's forum for ZeosLib 7.0.x series

Report problems concerning our Delphi 2009+ version and new Zeoslib 7.0 features here.
Post Reply
thejhorse
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 07.03.2013, 18:01

MySQL ZStoreProc error

Post by thejhorse »

Hi,

iam try develop with ZeosLib but it is hard.
I have a MySQL store procedure:

[font=Courier New]
CREATE PROCEDURE spGetLogin
(
IN sUsername VARCHAR(32),
IN sPassword VARCHAR(32),
INOUT iUserId INT,
INOUT iReturn INT
)
BEGIN
SELECT iReturn=userrol, iUserId=sysuserid FROM directorio.estsysusers
WHERE (usernickname = sUsername) AND (userpassword = sPassword);
END;
[/font]

in mi XE2 app, i call and get a error message:

"SQL Error:Procedure spGetLogin can´t return a result set in the given context"

what it the wrong...?
miab3
Zeos Test Team
Zeos Test Team
Posts: 1310
Joined: 11.05.2012, 12:32
Location: Poland

Post by miab3 »

@thejhorse,

I'd do it like this:

Code: Select all

CREATE PROCEDURE spGetLogin 
 ( 
 IN sUsername VARCHAR(32), 
 IN sPassword VARCHAR(32), 
 OUT iUserId INT, 
 OUT iReturn INT 
 ) 
 BEGIN 
 SELECT userrol, sysuserid INTO iReturn, iUserId FROM directorio.estsysusers 
 WHERE (usernickname = sUsername) AND (userpassword = sPassword); 
 END;
and

Code: Select all

ZStoredProc1.Close;
ZStoredProc1.StoredProcName:='directorio.spGetLogin';
ZStoredProc1.Params[0].Value:='User1';
ZStoredProc1.Params[1].Value:='Password1';
ZStoredProc1.ExecProc;
Edit1.Text:=ZStoredProc1.Params[2].AsString+','+ZStoredProc1.Params[3].AsString
Michal
Post Reply