Parameters in Stored Procedures

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
woec
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 23.04.2013, 20:47

Parameters in Stored Procedures

Post by woec »

Hi,

I tried to call Stored Procedures using TZStoredProc on MS SQL Server 2008 and I experience problems submitting parameters:

Here is my code (fragment):

with SP1 do begin
StoredProcName := 'test';
p0:=params.createparam(ftDateTime,'@par1',ptInput);
p1:=params.createparam(ftVariant,'@par2',ptInput);
ParamByName('@par1').Value := '20130707';
ParamByName('@par2').Value := '302092';
Open;
sp1.Params.RemoveParam(p0);
sp1.Params.RemoveParam(p1);
end;

Calling with this ends up with the following message in ZSQLMonitor-Log:
Execute, proto: FreeTDS_MsSQL>=2005, msg: exec sp_sproc_columns 'test', null, null, null
Other, proto: FreeTDS_MsSQL>=2005, msg: EXECUTEPREPARED:dbRPCExec, errcode: 0, error: DBError : [0201] : General SQL Server error: Check messages from the SQL Server
Procedure or function 'test' expects parameter '@par2', which was not supplied.

Calling the stored procedure by executing a TZQuery works.
So, it seems the TZStoredProc has Problems with parameters. If the parameters are defined within the object inspector only (without the two create-lines as in the code above listed), they are not known at all, so this definition does not have any effect.

Maybe, I Do not use TZStoredProc in a proper way?

Environment: Lazarus 1.0.10 on Windows XP, Zeoslib: 7.0.4

Any help would be nice,
woec
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Parameters in Stored Procedures

Post by EgonHugeist »

The TZStoredProc determines all available Params by MetaInformations on assigning StoredProc-name.

It might be possible the params are named different and you can't assign the values this way. Did you check it @designtime too?

Which lib do you use for connect?
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
woec
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 23.04.2013, 20:47

Re: Parameters in Stored Procedures

Post by woec »

Hi, Michael

thanks for reply.

I tried at design time and get the same error message about the missing parameter, wenn I try to set the Procedureobject to Active.
Also I noticed, there is no possibility to assign a value to a parameter at design time ?

I use msdblibd.dll (Build 2012-11-08) Protocol FreeTDS-mssql >= 2005

Sincerely
Johann
User avatar
EgonHugeist
Zeos Project Manager
Zeos Project Manager
Posts: 1936
Joined: 31.03.2011, 22:38

Re: Parameters in Stored Procedures

Post by EgonHugeist »

I'm sorry for the long delay.

Your issue makes me wondering, May i ask for an example?

Hint FreeTDS is a trouble-maker here. Zeos uses the native access and there are 3 functions missing in the FreeTDS implementation. Long times i'm looking for somebody who can fix the lib, recompile everything and share the lib's..
Best regards, Michael

You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/

Image
woec
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 23.04.2013, 20:47

Re: Parameters in Stored Procedures

Post by woec »

Hi Michael,

thanks for your reply. Please tell me, wich additional part(s) of code beyond the fragment I supplied as example in my first post of this thread you need.

Best regards,
Johann
Post Reply