Article View: borland.public.cppbuilder.database.ado
Article #1816Access violation when deleting TADOQuery object
From: Dan Schmidt
Date: Sat, 07 Feb 2004 00:56
Date: Sat, 07 Feb 2004 00:56
56 lines
2757 bytes
2757 bytes
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:
<402437cb$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,6fc050c7c8a84663,start X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2004-02-06 17:09:40 PST From: "Dan Schmidt" <dan.schmidt@zedisolutions.com> Newsgroups: borland.public.cppbuilder.database.ado Subject: Access violation when deleting TADOQuery object Date: Fri, 6 Feb 2004 17:56:02 -0700 Lines: 58 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: 139.142.33.20 Message-ID: <402437cb$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1076115403 139.142.33.20 (6 Feb 2004 16:56:43 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail