Subject | RE: [IBO] InsertSQL |
---|---|
Author | Eric Tishler |
Post date | 2004-05-03T12:57:09Z |
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
etishler@...
-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Monday, May 03, 2004 8:49 AM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] InsertSQL
At 02:32 PM 3/05/2004 +0200, you wrote:
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.
Helen
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - 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:
http://groups.yahoo.com/group/IBObjects/
* To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com <mailto:IBObjects-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of <http://docs.yahoo.com/info/terms/> Service.
[Non-text portions of this message have been removed]
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
etishler@...
-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Monday, May 03, 2004 8:49 AM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] InsertSQL
At 02:32 PM 3/05/2004 +0200, you wrote:
>HiIf it's a column in the query *and* the query is in the InsertSQL property
>
>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
>Insert.
>I am not sure where or how to assign a value to this parameter.
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.
Helen
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - 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:
http://groups.yahoo.com/group/IBObjects/
* To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com <mailto:IBObjects-unsubscribe@yahoogroups.com?subject=Unsubscribe>
* Your use of Yahoo! Groups is subject to the Yahoo! Terms of <http://docs.yahoo.com/info/terms/> Service.
[Non-text portions of this message have been removed]