🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #1485

ADO Connection / Disconnection Help

#1485
From: Heinz
Date: Thu, 22 Apr 2004 15:14
63 lines
2809 bytes
I've made a TTestDatabaseModule (type is a TDataModule) with a Constructor and Destructor.

TTestDatabaseModule::DataModuleCreate(TObject *Sender)
{
   MyADOConnection1->Open();
}

TTestDatabaseModule::DataModuleDestroy(TObject *Sender)
{
   MyADOConnection1->Close();
}

In my MainForm, there are 3 Buttons:
Button1: Connect to my DB
Button2: Disconnect to my DB
Button3: Query a Table inside my DB

For Button1:
I create an instance of my TTestDatabase and check for the Connection Status

   MyMainBody = new TTestDatabase(NULL);
   MyMainBody->DataModuleCreate(MyMainBodyForm);

   <Check for Connected Property == true>
   MyMainBody->MyADOConnection1->Connected == true
   // Edit1 will show TRUE or FALSE string based on if/else condition


For Button2:
Do a Disconnection and check for the Connection Status

   MyMainBody->DataModuleDestroy(MyMainBodyForm);

   <Check for Connected Property == true>
   MyMainBody->MyADOConnection1->Connected == true
   // Edit1 will show TRUE or FALSE string based on if/else condition

For Button3:
This Query is tide in with a TDBGrid on the MyMainBodyForm
<Some Query Statement that works>
SQL Statement something something
Query1->Open();
<Use see the Query on the Grid>

Now my problem is:
I connect to the DB (Press Button1) - All is Okay (TRUE in Edit1)
I Query my DB (Press Button3) - All is Okay (I see my data in the TDBGrid)
I disconnect from my DB (Press Button2) - All is Okay (FALSE in Edit1)

I try reconnecting:
I connect to the DB (Press Button1) - All is Okay (TRUE in Edit1)
I Query my DB (Press Button3) - I see nothing?
I disconnect from my DB (Press Button2) - All is Okay (FALSE in Edit1)

Why is my Query on a Reconnect not displaying?
Is there a Disconnection problem? I'm not following through with something? The Builder help says Close or Active = false will kill the connection.

Thanks for the help.
Heinz


   
Technical Details
Message-ID: <4087e16f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10698b,9fc947fa13652795,start
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2004-04-22 08:40:32 PST
From: "Heinz" <pingpongoz@n0spam.h0tmail.n0spam.c0m>
Sender: "Heinz" <pingpongoz@n0spam.h0tmail.n0spam.c0m>
Reply-To: "Heinz" <pingpongoz@n0spam.h0tmail.n0spam.c0m>
Subject: ADO Connection / Disconnection Help
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 146.131.120.2     
NNTP-Posting-Host: 207.105.83.66
Message-ID: <4087e16f$1@newsgroups.borland.com>
Date: 22 Apr 2004 08:14:55 -0700
X-Trace: newsgroups.borland.com 1082646895 207.105.83.66 (22 Apr 2004 08:14:55 -0700)
Lines: 64
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail