Subject Re: [IBO] Re: Migration, and DB connect issues as new screens are opened.
Author Helen Borrie
At 11:04 AM 9/03/2010, you wrote:


>Some other items I have learned.
>How does a component know how to find anther form such as the Data Module (DM). Is there are search path some where in project settings that controlls this.

It's accessed in the code of the data-aware controls, via their Datasource property. Many forms [can] use the same DM. Make sure your DMs are created before any forms that use them.

Your problem sounds like cruft hanging around from an old BDE or IBX application Assuming you are using TIBO components for your datasets, not the native TIB_, nil out the DatabaseName property (which is just a string in IBO) and use instead the tib_Connection property. Same goes on the tib_connection itself - use the Server, Path and Protocol properties and get rid of anything that is hanging about in Params.

NB, for Path, it is best by far to use database aliasing. I think you said you were using InterBase - it would be surprising if it doesn't have some sort of aliasing by now. It just makes it sooo simple to port apps to work on a different server.

And, tip: in the DatabaseName property of tib_connection, put a friendly name in there (like apples or candy or whatever you like), preferably before you ever start setting those connection properties...that way, nothing in the application will get anything "useful" by reading that property and find a way to create an unwanted separate connection.

>As a temporary work around:
>If I reconnect the IB_connection before I open the table:
>
> qryOrgInfo.IB_Connection:=DM.IB_Connection1;
> qryOrgInfo.Open;
>
>Then the problem goes away. I seems like there is some search path thing about the project itself that is lost or confused.

The component properties are what you have to fix, so that you're are not unintentionally hooking them up to a completely separate set of handles. I'm sure I don't have to warn you that having the same component hooking up at random to more than one connection context is somewhat....unhealthy...

There's nothing wrong with testing for the connection before you activate a form, though, e.g.,

if not MyDm.ib_connection1.connected then
MyDm.ib_connection1.connect;

Oh, and do make sure your databases don't have ".gdb" as the file suffix.

Helen