Subject Re: [IBO] Records show at design time but not runtime
Author mitch_landor
--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@...> wrote:
>
> At 09:25 PM 10/03/2006, you wrote:
> >I've placed TIB_Connection, TIB_Query, TIB_Datasource onto a
DataModule.
> >
> >I've placed TIB_Grid, TIB_Navigationbar, TIB_Searchbar, TIB_Updatebar
> >onto a form.
> >
> >The form "uses" the datamodule.
> >
> >Everything seems to be active and I can see the data in the grid at
> >design time. But when I run the Form the grid comes up blank and the
> >TIB_Navigationbar, TIB_Updatebar are greyed out.
> >
> >Tips would be greatly appreciated.
>
> In the FormCreate method of the datamodule you must connect to the
> database. If you want the form to open with the dataset open, you
> have to open it!
>
> Let's say the datamodule is DM and the components have their default
> assigned names here...
>
> begin
> if not ib_connection1.Connected then
> ib_connection1.Connect;
> with ibquery1 do
> begin
> if not ib_transaction.started then
> ib_transaction.StartTransaction;
> Open;
> end;
> end;
>
> Once you get the hang of it, you will need to build in some exception
> handling with try...except but this will do for now. :-)
>
> Helen
>



Sorry to be a nuisance...

I get this error when running the code listed below (I log in with
SYSDBA & masterkey):

'Access violation at address 004A977C in module 'TestProj2.exe'. Read
of address 00000054'. Process TestProj2.exe (2424)

procedure TDataModule3.DataModuleCreate(Sender: TObject);
begin
if not ib_connection1.Connected then
ib_connection1.Connect;
with ib_query1 do
begin
if not ib_transaction.started then
ib_transaction.StartTransaction;
Open;
end;
end;