Article View: borland.public.cppbuilder.database.ado
Article #1817Re: Access violation when deleting TADOQuery object
From: Viatcheslav V. Vassiliev
Date: Sun, 08 Feb 2004 09:01
Date: Sun, 08 Feb 2004 09:01
77 lines
3674 bytes
3674 bytes
> FQuery->Fields->Remove(FField1);
> delete FField1;
Try remove these lines - fields collection and all its objects will be
destroyed with delete FQuery.
//------------------------------------------
Regards,
Vassiliev V. V.
http://www.managed-vcl.com - using .Net objects in Delphi for Win32 +
ADO.Net
http://www.oledbdirect.com - The fastest way to access MS SQL Server,
MS Jet (Access) and Interbase (through OLEDB)
"Dan Schmidt" <dan.schmidt@zedisolutions.com> �������/�������� � ��������
���������: news:402437cb$1@newsgroups.borland.com...
> I am using BCB6 Enterprise to create a web service (primarily using the
Web
> App Debugger for now). My web service must open a query to an Oracle table
> when the service starts up. My database connection start up code looks
like
> this:
>
> // Create connection to Oracle database
> FOracleConnection = new TADOConnection(Application);
> FOracleConnection->LoginPrompt = false;
>
> // Create main data access point
> FQuery = new TADOQuery(FOracleConnection);
>
> FOracleConnection->ConnectionString = WideString(...);
> FOracleConnection->Open(...);
> if (FOracleConnection->Connected)
> {
> FQuery->Connection = FOracleConnection;
> FQuery->SQL->Text = "select ...";
> FQuery->LockType = ltOptimistic;
> FQuery->Prepared = true;
> FQuery->Open();
> } // if Connected
>
> Then my service does some stuff. Then it closes down:
>
> FQuery->Close();
> delete FQuery;
>
> // Close Oracle database connection
> FOracleConnection->Close();
> delete FOracleConnection;
>
> If I allow the query to use dynamic fields, everything works just fine.
> Unfortunately, one of the fields in the query is a data type of
"DECIMAL(20,
> 0)", which none of the dynamic field types handle properly. So, I need to
> override the field types using my own defined persistent field objects.
>
> FField1 = new TVariantField(FQuery);
> FField1->FieldName = ...;
> FField1->DataSet = FQuery;
> FQuery->Fields->Add(FField1);
>
> And so on. Everything works fine until I try to delete the query object:
>
> FQuery->Close();
> FQuery->Fields->Remove(FField1);
> delete FField1;
> delete FQuery;
>
> The "delete FQuery;" statement generates an access violation at an address
> residing deep in the ADO source code. But, only when I use persistent
> fields.
>
> Does anyone know why this might be happening? Please help me!
>
> Dan
>
>
Technical Details
Message-ID:
<4025fb03$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-05!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<402437cb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,6fc050c7c8a84663 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-02-08 01:23:27 PST From: "Viatcheslav V. Vassiliev" <support@oledbdirect.com> Newsgroups: borland.public.cppbuilder.database.ado References: <402437cb$1@newsgroups.borland.com> Subject: Re: Access violation when deleting TADOQuery object Date: Sun, 8 Feb 2004 12:01:51 +0300 Lines: 79 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: <4025fb03$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1076230915 213.234.218.42 (8 Feb 2004 01:01:55 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-05!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail