Subject | Re: [IBO] first steps: query and cursor |
---|---|
Author | Helen Borrie |
Post date | 2001-11-30T23:20:02Z |
At 11:19 PM 30-11-01 +0100, Boris wrote:
regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>Hello!For IB_Cursor, use First, not Open.
>
>For looking up city-names on zips I today coded this routine:
>
> with IB_Cursor1 do begin
> ParamByName('plz').AsString:=Edit1.Text;
> Open;See above.
> while not Eof do begin
> ComboBox1.Items.Add(Fields[2].AsString);
> Next;
> end;
> Close;
> end;
>
>Did I get that correctly?
>I've got the feeling, this routine may still be optimized:
>Can I save the Open/Close-routines somehow?
>What is better to use: Query or Cursor?Cursor is perfect for this type of operation - you don't don't any of the overhead for the bi-directional dataset that IB_Query imposes.
>Should I Unprepare after using?No. Prepare is needed to feed the metadata info to the component. It only needs to be unprepared if the statement is going to be changed. (No unprepare is necessary if only the param values change). IBO automatically unprepares the statement when necessary.
>Is preparation made automatically?
>Do I need preparation anyway?
regards,
Helen
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________