parameters in stored precedures
Posted: 24.04.2013, 07:26
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
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