Article View: borland.public.cppbuilder.database.ado
Article #2988Re: Problem with ADODataSet
From: Alen Markov
Date: Wed, 15 Jan 2003 21:23
Date: Wed, 15 Jan 2003 21:23
84 lines
3288 bytes
3288 bytes
I was asking if you have XP because I have a similar Problem:
My Software works fine on Win98 and W2K, but as soon as I run it on XP,
this message appears:
"Entweder BOF oder EOF ist True, oder der aktuelle Datensatz wurde gel�scht.
Der angeforderte Vorgang ben�tigt einen aktuellen Datensatz."
It's in German - but you can see that there is something wrong with "BOF"
and "EOF"...
(Note that my Databasefile is at the beginning complete EMPTY, means no
rows of data entered... after there is some data in the table, everything
works
fine... But in my case I need to give the usere an empty database when he
installs the software for the first time...)
In my code in the event "ON FORM SHOW" I'm calling a method
"fillComboboxes()" that contains this code:
AnsiString sqlStatement;
sqlStatement = "SELECT * FROM CD";
ADOQueryCD2->Close();
ADOQueryCD2->SQL->Clear();
ADOQueryCD2->SQL->Add(sqlStatement);
ADOQueryCD2->Open();
and that's exactly the part that doesn't work under XP, because when I
remark that
last line of code:
//ADOQueryCD2->Open();
I can start the Programm under XP without Errors...
Because I saw Marks comment:
"Try setting the Connection property AFTER you set the CommandText"
I modified my code as follows: (ignore the linenumbers)
001: AnsiString sqlStatement;
002: sqlStatement = "SELECT * FROM CD";
003: ADOQueryCD2->Close();
004: ADOQueryCD2->SQL->Clear();
005: ADOQueryCD2->SQL->Add(sqlStatement);
006: if(ADOQueryCD2->Active == false)
007: {
008: ADOQueryCD2->Active = true;
009: }
010: ADOQueryCD2->Open();
and now I can start it in WinXP without errors too, even the databasefile is
empty at the beginning...
But because later on in the code I'm using that method
"fillComboboxes()" again, my next line of code looks like this:
011: int iRowsCD2 = ADOQueryCD2->RecordCount;
This one seems to work under XP without crashing
(it returns the value 0 because the Database is empty).
So I continued with this lines of code:
012: if(iRowsCD2 == 0)
013: {
014: ADOQueryCD2->Active = false;
015: }
But here at line 14 XP crashes again with the same Errormessage as shown
above :-/
However - 22:22PM over here, time for bed and no more code for today...
99
Alen
--
WEB: http://www.come.to/nostromo
Technical Details
Message-ID:
<3e25d165@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3e22d4c2@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10698b,d8356b91db362088 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2003-01-15 13:40:08 PST From: "Alen Markov" <NOSPAM_amarkov@gmx.net> Newsgroups: borland.public.cppbuilder.database.ado References: <3e22d4c2@newsgroups.borland.com> Subject: Re: Problem with ADODataSet Date: Wed, 15 Jan 2003 22:23:38 +0100 Lines: 96 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 80.218.79.120 Message-ID: <3e25d165@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1042665829 80.218.79.120 (15 Jan 2003 13:23:49 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeed.online.be!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail