Page 1 of 1

parameters in stored precedures

Posted: 24.04.2013, 07:26
by woec
Hi,

I tried to call a storedprocedure using TZStoredProc Object with a parameter set. Seems, the parameter setting is ignored - the procedure is executed, but the default parameter defined within the stored procedure on the database server is used.
I place a TZStoredProc Object onto the form and set connection infos and a parameter @par1 with properties parametertype= ftInput and datatype = ptInteger
Here is the code:

with sp1 do begin
Close;
ParamByName('@par1').Value := 10;
Open;
end;

TZSQLMonitor tells me just "exec sp1" (without parameters)
sp1 returns data from a query, which works. If I omit the parameter settings in the TSStoredProc Object, I get an error on execution "@par1 unknown"

I use lazarus 1.0.8 and zeoslib 7.0.3 stable and FreeTDSLibrary with protocol set to FreeTDS_MSSQL>=2005; I connect to a MS-SQL Server 2005

Can anyone give me help for the problem?

Johann

Parameters in stored procedures

Posted: 29.04.2013, 14:32
by woec
Hi,

maybe I should put my problem into the database servers -> ms sql server - thread. There I found a similar problem description in the entry http://zeos.firmos.at/viewtopic.php?t=3483. The contributor solved it by declaring a resultparameter prior to the input parameter.

This makes the input parameter recognized also for me. So it seems to solve the problem in a workaround manner.
But I suspect there is a problem with the interface code of the library.

Johann