Page 1 of 1

Create MyStoredProc at runtime What`s is Wrong ?

Posted: Fri 08 Aug 2008 13:20
by Daniel Fagnan
Var proc :tMyStoredProc;
begin
Try

Screen.Cursor :=crHourGlass;

Proc := TmyStoredProc.Create(self);
Proc.Connection := MyConnection1;
Proc.StoredProcName := 'H_CALC';
Proc.Params[0].asString := 'WO000345'
Proc.Prepare;
Proc.ExecProc;
Finally
Proc.Free;
Screen.Cursor := crDefault;
End;

If assign to tMyStoredProc Components all is Ok but if I assign StoredProcName at runtime nothing 8) to execute. Why?

Posted: Mon 11 Aug 2008 12:48
by Dimon
You should add the following code:

Code: Select all

  Proc.PrepareSQL;
after the line:

Code: Select all

  Proc.StoredProcName := 'TestParam';