Subject RE: [IBO] InsertSQL
Author Eric Tishler
Well, Helen beat me to it :-), but I find the following syntax more readable (if you are doing this in straight code) since you can address the columns by name:

Using a TIB_Query with parameters, such as the :NoteID and :Description parameters you have below, and the TIB_Query is called qryTemp, use the following syntax:

// make sure the query is not active to start with
qryTemp.Active := False;

qryTemp.FieldByName('NoteID').AsInteger := 12345; // I am guessing this field is an INTEGER
qryTemp.FieldByName('Description').AsString := 'ABCDE'; // I am assuming this field is a VARCHAR

// once your parameters are filled in you can run the query:
qryTemp.Active := True;

BTW - I may be wrong, but from what I gather Helen explained to me it is better to use TIBOQuery for DSQL statements and TIB_Query for statements that return a result set. TIBOQuery has the same FieldByName method, so the syntax would be the same.

Eric Tishler
Software Architect
Resolute Partners, LLC
Phone: 203.271.1122
Fax: 203.271.1460

-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Monday, May 03, 2004 8:49 AM
Subject: Re: [IBO] InsertSQL

At 02:32 PM 3/05/2004 +0200, you wrote:
>I am using TIB_Query and would like to define the following InsertQuery:
>insert into \"Note\"(\"NoteID\", \"Description\", \"NoteDate\")
> values(:\"NoteID\", :\"Description\", CURRENT_TIMESTAMP)
>where NoteID is a parameter I would like to assign when executing the
>I am not sure where or how to assign a value to this parameter.

If it's a column in the query *and* the query is in the InsertSQL property
of the ib_query *and* the query column & parameter have the same
identifier, you won't have to assign it--IBO will do it automatically.

Otherwise, in state dssInsert, event BeforePost:

Params[0].Value := aVariable;

Of course, if it's a GeneratorLink, you can just ignore it, since IBO will
fetch and assign it at the right time.


IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________ - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !


Yahoo! Groups Links
* To visit your group on the web, go to:

* To unsubscribe from this group, send an email to: <>

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of <> Service.

[Non-text portions of this message have been removed]