🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#1406
From: Viatcheslav V. Vassiliev
Date: Wed, 14 Jul 2004 06:17
41 lines
1968 bytes
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.
>
Technical Details
Message-ID: <40f4d007$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <40f4119e$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: "Viatcheslav V. Vassiliev" <support@oledbdirect.com>
Newsgroups: borland.public.cppbuilder.database.ado
References: <40f4119e$1@newsgroups.borland.com>
Subject: Re: proper form for a try/catch on an ado object
Date: Wed, 14 Jul 2004 10:17:47 +0400
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 213.234.218.42
Message-ID: <40f4d007$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1089785863 213.234.218.42 (13 Jul 2004 23:17:43 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail