Article View: borland.public.cppbuilder.database.ado
Article #3128Re: Problem About TADOQuery And MDAC 2.X?
From: Mountain Lan
Date: Thu, 14 Nov 2002 09:57
Date: Thu, 14 Nov 2002 09:57
106 lines
3878 bytes
3878 bytes
It's ok when using OLE DB driver, but crashes when using Microsoft OLE DB
for ODBC driver.
There is another way to avoid the problem, sample codes as below:
ADOQuery1->SQL->Text = "SELECT * FROM SYS_USER";
ADOQuery1->Open();
ADOQuery1->Close();
//Reestablish connection between ADOConnection and ADOQuery.
//Otherwise, a error will occur when execute a command.
ADOQuery1->Connection = NULL;
ADOQuery1->Connection = ADOConnection1;
ADOQuery1->SQL->Text = "UPDATE SYS_USER SET STATUS = 'A'";
ADOQuery1->ExecSQL();
But I am still confused. Is it a bug in MDAC or BCB?
Mountain
"Mark Guerrieri" <markg11@comcast.net> д����Ϣ����
:3dcee7e0$1@newsgroups.borland.com...
> I have used BCB5/ADOExpress with all versions of Windows and all version
of
> MDAC (up to 2.7) and have not encountered any problems like that.
>
> If your recordset is not read only or disconnected, why not just query the
> record in question, then
>
> ADOQuery1->Edit();
> ADOQuery1->FieldByName("STATUS")->AsString = "A";
> ADOQuery1->Post();
>
> or better yet, use a TADOCommand object to execute SQL commands that don't
> return recordsets.
>
> I'm not saying there is no problem just because I have not encountered
one,
> but using command objects for UPDATE commands always works for me.
>
> Mark
>
> "Mountain Lan" <swatow@sina.com> wrote in message
> news:3dcc6f2b@newsgroups.borland.com...
> > Hi, friends,
> >
> > I am using BCB5 with SP1 and ADOExpress SP. My program works well on
> Windows
> > 2000(SP3). But when softwares, which upgrade MDAC (such as SQL Server
> 2000,
> > Visual Studio .Net, and so on) installed on my computer, my program
> crashed.
> > My program can't run on Windows XP either, which has a newer MDAC too.
> >
> > There is something wrong with TADOQuery when working with newer MDAC. I
> > found that TADOQuery component couldn��t execute a UPDATE or INSERT
> command
> > once it had been used to retrieve dataset using SELECT command. My test
> > codes are very simple:
> >
> >
> >
> > ADOQuery1->SQL->Text = "SELECT * FROM SYS_USER";
> >
> > ADOQuery1->Open();
> >
> > ADOQuery1->Close();
> >
> >
> >
> > ADOQuery1->SQL->Text = "UPDATE SYS_USER SET STATUS = 'A'";
> >
> > ADOQuery1->ExecSQL();
> >
> >
> >
> > An exception is raised here: Access violation at address xxxxxx in
> > msado15.dll.
> >
> >
> >
> > If I never use TADOQuery component to open a dataset, but use it to
update
> > data only, this exception will never be raised.
> >
> >
> >
> > What's wrong in it? I've tried to install MDAC 2.6 SP1, MDAC2.6 SP2,
MDAC
> > 2.7 on my computer, but couldn't eliminate this error. Thank you very
> much!
> >
> >
> >
> > Mountain
> >
> >
> >
> >
> >
> >
> >
>
>
Technical Details
Message-ID:
<3dd373a0@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3dcc6f2b@newsgroups.borland.com> <3dcee7e0$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,342bf5b350cbdf1 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-11-14 02:22:05 PST Reply-To: "Mountain Lan" <swatow@sina.com> From: "Mountain Lan" <swatow@sina.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3dcc6f2b@newsgroups.borland.com> <3dcee7e0$1@newsgroups.borland.com> Subject: Re: Problem About TADOQuery And MDAC 2.X? Date: Thu, 14 Nov 2002 17:57:10 +0800 Lines: 108 Organization: Ideal Tech X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 61.174.183.210 Message-ID: <3dd373a0@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1037267872 61.174.183.210 (14 Nov 2002 01:57:52 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail