Subject Re: [IBO] Inheritance porblem (repost)
Author Helen Borrie
At 09:06 PM 19-09-02 -0300, you wrote:
>I am using D5, IBO 4.2.Gc.
>I created a Datamodule and dropped a TIB_Connection on it.
>I named it IBO_Access.
>I create a second Datamodule that inherits IBO_Access, I named it
>IBO_Access1. This will be the one that I will use in my project (Uses
>I create a Datamodule and dropped a IBOQuery on it.
>I am using IBO_Access1 in Uses clauses.
>I set IBOQuery1.IB_Connection to IBO_Access1.IB_Connection.
>I can enter the query, but I cannot AddFields using the Fields Editor.
>There=B4s an error that says that a blank statement cannot be prepared.
>I double checked all my connections and the only blank statement I
>have is in IBO_Access (Parent datamodule).
>When I close the application and reopen it, I have 2 login forms to
>enter. The first one fills the Database name correctly ( I guess its
>the derived one IBO_ACCESS1 where all the info is filled at design
>time). The second one is totally blank (No info is filled) it must be
>from IBO_Access (parent Datamodule).
>Can I inherited IB_Connection from a parent Datamodule?
>Should I be doing this?=20

I saw your earlier post and thought it was something Jason would comment
on. However, Jason is sick at present, so I will just make a few
comments...not understanding why you need to use inheritance at all.

AFAIK, by inheriting the ib_connection, you are inheriting the *properties*
of the ancestor connection, not the connection itself. For both
datamodules to use the *same* connection, you would need (I think) to set
the dbHandleShared property true on the descendant connection. But I'm not
certain that the logic exists to do this handle-sharing with a non-BDE

Why do you need inheritance for a datamodule? If you just want to save
typing, why not use a TIB_ConnectionSource on your secondary data modules?

Actually, I just add my primary DM (the one that has the IB_Connection) to
the uses clauses of my dependent DMs. This makes the primary DM's
ib_connection visible to the secondary DM. This is not because I think
IB_ConnectionSource is a bad idea (I certainly don't!!) - it's just what I
have always done and it works fine.