Hi,
I have a small problem:
I open a stored procedure using the TMSStoredProc object. Everything works fine. Only the parameters I specified where lost all the times. When I open the MSStoredProc Editor and specify my parameters I can access my data. When I close the editor and open it again, the parameters where set to "NULL".
Is it a bug?
Alex
Parameter of stored procedure lost...
Hello,
The point is that SDAC uses the @ symbol for working with parameters. To avoid both problems (here and http://www.devart.com/forums/viewtopic.php?t=21420), you should alter your procedure in the following way:After this, to access a parameter by name, you should use the following code:
The point is that SDAC uses the @ symbol for working with parameters. To avoid both problems (here and http://www.devart.com/forums/viewtopic.php?t=21420), you should alter your procedure in the following way:
Code: Select all
ALTER PROCEDURE [dbo].[]
@xxx INT
AS
BEGIN
...
Code: Select all
MSStoredProc.ParamByName('xxx').AsString := 'test';
Hi,
this do only partly work. The parameter will no not be lost anymore. But I can still not access it. I get always the error "Parameter 'xxx' not found'...
Any other idea?
Alex
this do only partly work. The parameter will no not be lost anymore. But I can still not access it. I get always the error "Parameter 'xxx' not found'...
Any other idea?
Alex
AndreyZ wrote:Hello,
The point is that SDAC uses the @ symbol for working with parameters. To avoid both problems (here and http://www.devart.com/forums/viewtopic.php?t=21420), you should alter your procedure in the following way:After this, to access a parameter by name, you should use the following code:Code: Select all
ALTER PROCEDURE [dbo].[] @xxx INT AS BEGIN ...
Code: Select all
MSStoredProc.ParamByName('xxx').AsString := 'test';
Please try using the following code:
Code: Select all
MSStoredProc.StoredProcName := 'stor_proc_name';
MSStoredProc.PrepareSQL;
MSStoredProc.ParamByName('xxx').AsString := 'test';
MSStoredProc.Open;
Hi,
I found the problem. Changing the procedure in the SQL-Server will not update the call parameters in the TMSStoredProc object. After I changed to another stored procedure and go back to original one, the parameters look ok.
Thank you verry much for your fast and professional help!
Alex
I found the problem. Changing the procedure in the SQL-Server will not update the call parameters in the TMSStoredProc object. After I changed to another stored procedure and go back to original one, the parameters look ok.
Thank you verry much for your fast and professional help!
Alex
AndreyZ wrote:Please try using the following code:Code: Select all
MSStoredProc.StoredProcName := 'stor_proc_name'; MSStoredProc.PrepareSQL; MSStoredProc.ParamByName('xxx').AsString := 'test'; MSStoredProc.Open;