Subject | Re: [IBO] Getting Started Guide. |
---|---|
Author | Helen Borrie |
Post date | 2001-09-10T07:06:29Z |
At 04:22 PM 10-09-01 +1000, you wrote:
with Components[ii] as TIB_Cursor do
If you don't have any tib_cursors that you want to open, don't include the ELSE clause - it's just unnecessary code clutter.
An alternative syntax for casting the component would be
TIB_Query(Components[ii]).Open
If you have already established the class of the object with 'IS', Delphi is supposed to allow you to call the methods of the class without explicitly casting it with 'AS'. For some reason, it doesn't always allow it, which is why I gave you the more verbose syntax - that should always work.
Also, you mentioned previously that you had dropped an ib_transaction (named Transaction) into your datamodule. Are you using that transaction? If so, make it the default transaction of your connection object and, for now, link your datasets to it via their ib_transaction property.
HB
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________
>I do want the datasets to be open when I start the application ... and I tried the following - but it raises exceptions as indicated ....What don't you understand?
>
>procedure TmyDatamodule.myDatamoduleCreate(Sender: TObject);
>var
> ii: integer;
>begin
> with myDatamodule do
> begin
> if not Connection.connected then
> Connection.Connect;
> // connect ib_queries I don't understand.
> for ii := 0 to ComponentCount - 1 do(* you might need this too *)
> begin
> if Components[ii] is TIB_BDataset then <-- try changing to tib_Query
> with Components[ii] as TIB_BDataset do <-- try changing to tib_Query
> Components[ii].Open // Undeclared identifier "Open"
> else if Components[ii] is TIB_Cursor do <-- change 'do' to 'then' (bad pasting!)
with Components[ii] as TIB_Cursor do
> Components[ii].First;The point of the difference is that you call Open to open a bi-directional dataset, whereas you call First on a unidirectional one to open it.
> end;
> ...
> end;
>end;
If you don't have any tib_cursors that you want to open, don't include the ELSE clause - it's just unnecessary code clutter.
An alternative syntax for casting the component would be
TIB_Query(Components[ii]).Open
If you have already established the class of the object with 'IS', Delphi is supposed to allow you to call the methods of the class without explicitly casting it with 'AS'. For some reason, it doesn't always allow it, which is why I gave you the more verbose syntax - that should always work.
Also, you mentioned previously that you had dropped an ib_transaction (named Transaction) into your datamodule. Are you using that transaction? If so, make it the default transaction of your connection object and, for now, link your datasets to it via their ib_transaction property.
HB
All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________