Article View: borland.public.cppbuilder.database.ado
Article #845Re: Cannot perform this operation on closed dataset
From: Michele Santucci
Date: Thu, 16 Jun 2005 08:25
Date: Thu, 16 Jun 2005 08:25
64 lines
2526 bytes
2526 bytes
I don't know if TADOConnection and TADOQuery objects are always
connected / activated after
they creation so you may try to do so by yourself:
TADOConnection *con = new TCon(Application);
TADOQuery *qry = new TADOQuery(Application);
con->Connected = true;
^^^^^^^^^^^^^^^^^^
String SQL = "SELECT * FROM TABLE WHERE A = B"; //example
qry = con->select(SQL);
qry->Active = true;
^^^^^^^^^^^^^^^
//do something with qry
delete qry;
delete con;
Hope this help... by[t]e(s)
"Danid" <danid@danid.com> ha scritto nel messaggio
news:42b05bb3$1@newsgroups.borland.com...
>
> Please help,
>
> I have the following function:
>
> TADOQuery *TCon :: select(String SQL)
> {
> //qryData is a TADOQuery
> try{
> qryData->SQL->Clear();
> qryData->SQL->Add(SQL);
> qryData->SQL->Open();
> } catch (EXception &e) {
> //
> }
> return qryData;
> }
>
> call this function in other classes:
>
> TADOQuery *qry = new TADOQuery(Application);
> TCon *con = new TCon(Application);
>
> String SQL = "SELECT * FROM TABLE WHERE A = B"; //example
> qry = con->select(SQL);
> //do something with qry
>
> delete qry;
> delete con;
>
> This code works fine excepts that it sometimes rises the following error:
> Cannot perform this operation on closed dataset
>
> How can I solve this?
> I looked on the internet but couldnt find a solution.
>
> Thanks,
>
>
Technical Details
Message-ID:
<42b13776$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<42b05bb3$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,614415b022334e0e X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Michele Santucci" <michele.santucci@celinavio.it> Newsgroups: borland.public.cppbuilder.database.ado References: <42b05bb3$1@newsgroups.borland.com> Subject: Re: Cannot perform this operation on closed dataset Date: Thu, 16 Jun 2005 10:25:26 +0200 Lines: 66 Organization: Celin Avio S.r.l. X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2527 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2527 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 80.86.50.144 Message-ID: <42b13776$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1118910326 80.86.50.144 (16 Jun 2005 01:25:26 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail