Re: TDataBase and TQuary



"Anton" <anton.txt@xxxxxxxxx> wrote in message
news:Xns99D819FCD3FCDantontxtgmailcom@xxxxxxxxxxxxxxxx

Can you help me with setting up a TDatabase so that it would allow to
explicitly control a DB connection instead of using the TDatabase that's
created at Run Time automatically?

I did the following (all in Run Time):

1. Create a TDatabase
2. Set its DatabaseName to my DB's Alias (as in BDE)
3. Call the Open method

4. Create a TQuery
5. Set its DatabaseName to that of TDatabase
6. Use it.

But that doesn't work for some reason. If I suddenle Close the
TdataBase, the TQuery continues working happily... From which I conclude
it's not using _my_ TDatabase.

I wouldn't jump to that conclusion. If you use a design-time TDatabase
and close that at runtime, does your query stop working as you expect?
Do past results remain available, can you query for new ones?

Perhaps taking one step at a time would help clarify things. Can you
set up a database and query at design-time, then create a database object
at runtime, and make the query switch to it? If you use two different
backend databases, you should be able to deduce from the query results
if it has actually switched.

Groetjes,
Maarten Wiltink


.



Relevant Pages

  • Re: TDataBase and TQuary
    ... Set its DatabaseName to my DB's Alias ... Call the Open method ... I would suggest using TDatabase that you already have on a Form during ... I would suggest using design time created TQuery also, ...
    (comp.lang.pascal.delphi.misc)
  • TDataBase and TQuary
    ... Can you help me with setting up a TDatabase so that it would allow to ... explicitly control a DB connection instead of using the TDatabase that's ... Set its DatabaseName to my DB's Alias ... the TQuery continues working happily... ...
    (comp.lang.pascal.delphi.misc)