TStoredProc doesn't get params
TStoredProc doesn't get params
Hello!
I use the UniDAC components for delphi7 I found a problem.
When I choose a stored procedure from the list(TUniStoredProc) it doesn't get the parameters of the procedure neither in design time nor in runtime.
If I active the dataset then get it but I need the params before call the procedure.
How can I solve this problem. Is there maybe a function or procedure, which can I use for this?
Thanks in advance.
I use the UniDAC components for delphi7 I found a problem.
When I choose a stored procedure from the list(TUniStoredProc) it doesn't get the parameters of the procedure neither in design time nor in runtime.
If I active the dataset then get it but I need the params before call the procedure.
How can I solve this problem. Is there maybe a function or procedure, which can I use for this?
Thanks in advance.
-
- Posts: 38
- Joined: Wed 16 May 2007 01:12
Hello,
What if the UniStoredProc object is created at run-time?
With MSStoredProc, I simply assign the StoredProcName field as shown below, and then the parameters are "assigned". With UniStoredProc, I do the same thing, but the parameters are not assigned and I get an exception when I try to set one. Is there some way to make the parameters "live" for UniStoredProc created at run-time?
FWSubSP = new TMSStoredProc( NULL );
FWSubSP->Connection = GUIConnection;
FWSubSP->StoredProcName = "ScadaFWSub10";
Thank you,
Joe
What if the UniStoredProc object is created at run-time?
With MSStoredProc, I simply assign the StoredProcName field as shown below, and then the parameters are "assigned". With UniStoredProc, I do the same thing, but the parameters are not assigned and I get an exception when I try to set one. Is there some way to make the parameters "live" for UniStoredProc created at run-time?
FWSubSP = new TMSStoredProc( NULL );
FWSubSP->Connection = GUIConnection;
FWSubSP->StoredProcName = "ScadaFWSub10";
Thank you,
Joe
You can use the TUniStoredProc.PrepareSQL method to obtain parameters of a stored procedure in the following way:For more information please read UniDAC Reference Manual.
Code: Select all
UniProc := TUniStoredProc.Create(nil);
UniProc.Connection := UniConnection;
UniProc.StoredProcName := 'Test_Proc';
UniProc.PrepareSQL;
Re: TStoredProc doesn't get params
I used this code but i got an Access Violation Error in "preparesql" Line. I dont know where i made a mistake and how can i fix it!
Begin
PROC_DEL_TBL_Students := TUniStoredProc.Create(Nil);
PROC_DEL_TBL_Students.Connection := DataModule1.UniConnection1;
PROC_DEL_TBL_Students.StoredProcName := 'DEL_TBL_Students';
PROC_DEL_TBL_Students.PrepareSQL();
With PROC_DEL_TBL_Students Do
Begin
Params.FindParam('PSID').Value := SID;
ExecProc;
End;
PROC_DEL_tbl_Students.Free
End;
Begin
PROC_DEL_TBL_Students := TUniStoredProc.Create(Nil);
PROC_DEL_TBL_Students.Connection := DataModule1.UniConnection1;
PROC_DEL_TBL_Students.StoredProcName := 'DEL_TBL_Students';
PROC_DEL_TBL_Students.PrepareSQL();
With PROC_DEL_TBL_Students Do
Begin
Params.FindParam('PSID').Value := SID;
ExecProc;
End;
PROC_DEL_tbl_Students.Free
End;
Re: TStoredProc doesn't get params
Please, compose a small test project to reproduce the problem and send it using the contact form on our website: http://www.devart.com/company/contactform.html . In the sample include a script to create the stored procedure.