🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: proper form for a try/catch on an ado object

#1413
From: steve
Date: Thu, 15 Jul 2004 08:30
46 lines
2246 bytes
"Viatcheslav V. Vassiliev" <support@oledbdirect.com> wrote:
>As usual:
>
>TADODataSet *rs = new TADODataSet(NULL);
>try
>{
>  rs->Connection = frmFrame->adoConnection;
>  //This may be set in designer or on connection-related code.
>  rs->Connection->LoginPrompt = false;
>  rs->CommandText = sql;
>  rs->Open();
>  try
>  {
>    ..
>  }
>  __finally
>  {
>    rs->Close();
>  }
>}
>__finally
>{
>  delete rs;
>}
>
>"Steve" <sportock@hotmail.com> �������/�������� � �������� ���������:
>news:40f4119e$1@newsgroups.borland.com...
>>
>> I am instantiating tadodatasets dynamically, not using the vcl stuff to
>drop on my form. What is the proper way to create the object and handle
>errors and releasing memory for it? I am doing them like this.
>>
>> TADODataSet *rs = new TADODataSet(NULL);
>> rs->Connection = frmFrame->adoConnection;
>> rs->Connection->LoginPrompt = false;
>> rs->CommandText = sql;
>> rs->Open();
>> rs->Close();
>> delete rs;
>>
>> I just can't seem to find any example code. Thanks in advance.
>>
>
>
Thanks, when ever using these types, do the connections have to be opened and closed explicitly? I know on recordsets, but how about adoquerys, or adocommands when just executing a simple sql statement?
Technical Details
Message-ID: <40f640b5$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!irazu.switch.ch!switch.ch!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40f4119e$1@newsgroups.borland.com> <40f4d007$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10698b,7efbd26a8e32ebe9
X-Google-Attributes: gid10698b,public
X-Google-Language: ENGLISH,ASCII
From: "steve" <sportock@hotmail.com>
Sender: "steve" <sportock@hotmail.com>
Reply-To: "steve" <sportock@hotmail.com>
Subject: Re: proper form for a try/catch on an ado object
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 24.178.50.100     
References: <40f4119e$1@newsgroups.borland.com> <40f4d007$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <40f640b5$1@newsgroups.borland.com>
Date: 15 Jul 2004 01:30:45 -0700
X-Trace: newsgroups.borland.com 1089880245 207.105.83.66 (15 Jul 2004 01:30:45 -0700)
Lines: 46
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!irazu.switch.ch!switch.ch!news.belwue.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail