Thread View: borland.public.cppbuilder.database.ado
1 messages
1 total messages
Started by Erba Andrea
Thu, 07 Dec 2000 14:04
Help ! ADO/ADOEXPRESS or SQLServer/MSDE with ORDER BY looses the first record !
Author: Erba Andrea
Date: Thu, 07 Dec 2000 14:04
Date: Thu, 07 Dec 2000 14:04
47 lines
2700 bytes
2700 bytes
Hello, I'm moving a database from Access to MSDE-SQLServer.
I have a very strange bug executing a simple query:
With ClientSide Cursor all works in the correct way.
With ServerSide Cursor happens this thing:
the same SQL expression loose the first record if I include the clause
"ORDER BY" !
example: table "USERS" contains 10 records; with:
sql1 = "SELECT * FROM USERS" the code below return 10 records;
the same code with the "ORDER BY" and any field name return 9 records,
loosing the first!
void __fastcall record_count() {
int count;
TADOQuery * q;
AnsiString conn_str = "Provider=SQLOLEDB.1;Persist Security
Info=True;User ID=SA;Data Source=MYSERVER;";
AnsiString sql1 = "SELECT * FROM USERS";
AnsiString sql2 = "SELECT * FROM USERS ORDER BY NAME";
count = 0;
q = new TADOQuery(this);
q->ConnectionString = conn_str;
q->CursorLocation = clUseServer;
q->SQL->Clear();
q->SQL->Add(sql2);
q->Open();
q->First();
while (!q->Eof) {
count ++;
q->Next();
}
ShowMessage("Number of records = " + IntToStr(count));
}
Maybe it's a problem of MSDE and serverside cursor, but I can't do other
tests
and I have to solve the problem as soon as possible.
(If could be of help: if I try to link a TDBGrid with ServerSide cursor
raises the exception "dataset doesn't support bookmarks etc...")
Can anyone help me ? Thank you!
andrea
I use Borland C++Builder Pro 5.0 with the first Update Patch,
ADOExpress with or without the ADOPatch of CodeCentral
MSDE from Microsoft Office 2000 professional (italian version);
the table is very simple with a ID= Primarykey and few Text fields
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads