Board index » delphi » Problem with TDatabase in design mode

Problem with TDatabase in design mode

I'm using a data module which has a TDatabase component in it,
and nothing else.  The idea is that by having all my TDataSet components
use this as their database, I can change what database the entire app
points to by changing just one component.  

In runtime, it works fine, but in design time, sometimes the forms which
rely on the TDataBase component are being created before the data module.
At least that's what seems to be happening.  

Any ideas as to how to get around this?

-Mike Conner
Milwaukee Software, Co, Inc.

 

Re:Problem with TDatabase in design mode


Quote
Mike Conner wrote:

> I'm using a data module which has a TDatabase component in it,
> and nothing else.  The idea is that by having all my TDataSet components
> use this as their database, I can change what database the entire app
> points to by changing just one component.

> In runtime, it works fine, but in design time, sometimes the forms which
> rely on the TDataBase component are being created before the data module.
> At least that's what seems to be happening.

> Any ideas as to how to get around this?

> -Mike Conner
> Milwaukee Software, Co, Inc.

I do this as well.  If you are having delphi save the state of your project
when you close it, then make sure that the form with the database is open at
that time.  If not always open that form before any others.

Scott Gray

Re:Problem with TDatabase in design mode


In article <4imlh3...@daily-planet.execpc.com>, mcon...@earth.execpc.com

Quote
(Mike Conner) wrote:
>I'm using a data module which has a TDatabase component in it,
>and nothing else.  The idea is that by having all my TDataSet components
>use this as their database, I can change what database the entire app
>points to by changing just one component.  

>In runtime, it works fine, but in design time, sometimes the forms which
>rely on the TDataBase component are being created before the data module.
>At least that's what seems to be happening.  

>Any ideas as to how to get around this?

>-Mike Conner
>Milwaukee Software, Co, Inc.

Hello Mike-

Pardon my butt-in, but since you seem to be working with a component I
need to use,
I was wondering if you might be able to help me with a problem I am having
with the
TDatabase component.    I am trying to create a Form which will act as a
replacement
for the standard login form that appears if you enable the login prompt in
the TDatabase
object viewer.   I would like this form to allow a user to enter a login
id/password combo
and then have the connection be created if the combo is a valid set.  At
that point another
form will pop-up and the program will continue on and use that database
info to perform
its stuff.   What I have so far is a form that accepts the entrys and has
a TDatabase comp.
in it.  What I am trying to get working is something like this:

   with MyDB do
    begin
       Params.Values['User Name'] := MyLoginIDVar;
       Params.Values['Password'] := MyPasswordVar;
    end;

    { At this point I would like to try and connect to the DB }
    { I think this below should work but it doesn't, Any ideas }
    { On how to approach handling the errors on a bad combo would be
welcome also!!!}
    MyDB.Connect  := True;

I get an error something like "Operation aborted" and the connection is
never opened.  I
would appreciate any insight that you could share with me on this and if
you know of any
good sources of info on this subject I'd appreciate any pointers to it you
could give me.
If not to much of a hassle could you copy me with an e-mail along with a
news post.
Thanks,

Marc Mondragon -> mar...@crt.com

+-----------------------------------+
|  Marcos A. Mondragon            NationsBanc-CRT        |
|  Unix Network Systems         233 S. Wacker Drive  |
|  E-Mail: mar...@crt.com    Chicago, IL 60187      |
+-----------------------------------+

Other Threads