Subject | Re: [IBO] help with stored procedures(help 2) |
---|---|
Author | Lucas Franzen |
Post date | 2004-02-24T15:43:39Z |
Daniel,
You're setting up the insertSQL of a TIB_Query.
This is usually done when you have complex inserts on a joined dataset
and you want to have request live on more than one table.
If this is what you want, then you don't have to access it via
Parambyname but with FIELDBYNAME( and there's no way of executing it,
this will be done when you post the recordset after an insert operation).
Example:
you join two tables, let's say A and B and you want to be capable of
inserting records in table A and B simulteanously (and from IB_Edits).
Then using the InsertSQL property is what you need so that the
underlying Storedproc can do two inserts.
If you want to insert records just in one side of the join, use the
KeyRelation property and forget aboput insertSQL.
If you really want to use a a Storedproc right away then a TIB_Query is
anything BUT an appropriate component for doing so.
Use a TIB_Stroedproc or a TIB_DSQL for executing your procedure.
Then you can assign param values.
Luc.
> Procedure:Do you really know what you're doing here?
> with DataM.AllLoc do
> begin
> ReadOnly := False;
> RequestLive := true;
>
> InsertSQL.Text := ' ';
> InsertSQL.Append('execute procedure NewLocation');
> InsertSQL.Append
> ('(:LOCCODE, :LOCNAME, :LOCTYPE , :ADD1, :ADD2, :CITY,');
> InsertSQL.Append
> (':PROV, :ZIP , :PHONE, :FAX , :AUX, :CONTACT, :EMAIL , :COMMENTS , :N
> OTE );');
>
> prepare;
>
> error ==> ParamByName('ADD1').value := 'testing';
>
> open;
> insert;
> end;
You're setting up the insertSQL of a TIB_Query.
This is usually done when you have complex inserts on a joined dataset
and you want to have request live on more than one table.
If this is what you want, then you don't have to access it via
Parambyname but with FIELDBYNAME( and there's no way of executing it,
this will be done when you post the recordset after an insert operation).
Example:
you join two tables, let's say A and B and you want to be capable of
inserting records in table A and B simulteanously (and from IB_Edits).
Then using the InsertSQL property is what you need so that the
underlying Storedproc can do two inserts.
If you want to insert records just in one side of the join, use the
KeyRelation property and forget aboput insertSQL.
If you really want to use a a Storedproc right away then a TIB_Query is
anything BUT an appropriate component for doing so.
Use a TIB_Stroedproc or a TIB_DSQL for executing your procedure.
Then you can assign param values.
Luc.