Article View: borland.public.cppbuilder.database.ado
Article #1490Re: ADO Connection / Disconnection Help
From: Viatcheslav V. Vassiliev
Date: Thu, 22 Apr 2004 16:19
Date: Thu, 22 Apr 2004 16:19
82 lines
3633 bytes
3633 bytes
> MyMainBody = new TTestDatabase(NULL);
> MyMainBody->DataModuleCreate(MyMainBodyForm);
Do not call DataModuleCreate() - it will be called automatically. If you
need to specify owner, do it in new TTestDatabase(MyMainBodyForm). The same
is for DataModuleDestroy().
I do not see also where you close query (Query1->Active = false) and
connection (MyADOConnection1->Connected = false) and where you destroy data
module (delete MyMainBody).
"Heinz" <pingpongoz@n0spam.h0tmail.n0spam.c0m> �������/�������� � ��������
���������: news:4087e16f$1@newsgroups.borland.com...
>
> 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:
<4087f08f$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4087e16f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,9fc947fa13652795 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-04-22 09:40:42 PST From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <4087e16f$1@newsgroups.borland.com> Subject: Re: ADO Connection / Disconnection Help Date: Thu, 22 Apr 2004 20:19:29 +0400 Lines: 84 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 213.234.218.42 Message-ID: <4087f08f$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082650767 213.234.218.42 (22 Apr 2004 09:19:27 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail