BCB6 always empty resultset returned
Posted: 25.11.2010, 11:40
I cannot find a solution, and google is not really helpful too
I use Borland C++ Builder 6 together with the ZEOS library for communication with a MySQL database. Before I used the old ZEOS lib (6.1.5 stable) together with a MySQL4 database. Everything worked perfect, but I had to upgrade to MySQL 5.1 now, so that's why I upgraded to ZEOS library 6.6.6. If i test my application now, I come to the following:
- there is a connection with the database
- I can do an Insert() and a Post() and the records are perfectly added to the database
problem:
I perform a very simple query:
This query gives about 800 records as a result in the MySQL command prompt. If I perform this query in my application, then I always get back 0 records. I tried all kind of things with object settings, database settings and I searched google, but I can't find any solution.
this is the code as it worked with ZEOSlib 6.1.5
My latest version for now (with ZEOSlib 6.6.6), which is not working:
Any hints? I think I have to search for a solution in the database settings, but that is just "stupid" thinking.
maybe some other usefull info:
- ik tried to use both libmysql.dll and libmysql51.dll
- when I look at the content of ZQuery->SQL->Text then I see that the value is not only my QueryString, but a \r\n is added to it. I have no idea how to get rid of the \r\n on that point and i have no idea if it has anything to do with my problem.
I use Borland C++ Builder 6 together with the ZEOS library for communication with a MySQL database. Before I used the old ZEOS lib (6.1.5 stable) together with a MySQL4 database. Everything worked perfect, but I had to upgrade to MySQL 5.1 now, so that's why I upgraded to ZEOS library 6.6.6. If i test my application now, I come to the following:
- there is a connection with the database
- I can do an Insert() and a Post() and the records are perfectly added to the database
problem:
I perform a very simple query:
Code: Select all
SELECT myfield FROM mytable
this is the code as it worked with ZEOSlib 6.1.5
Code: Select all
QueryString = "SELECT myfield FROM mytable";
ZQuery->Active = false;
ZQuery->SQL->Clear();
ZQuery->SQL->Add(QueryString);
ZQuery->Active = true;
AnsiString A = ZQuery->FieldByName("myfield")->AsString;
// A contains the right value
My latest version for now (with ZEOSlib 6.6.6), which is not working:
Code: Select all
QueryString = "SELECT myfield FROM mytable";
ZQuery->Active = false;
ZQuery->SQL->Clear();
ZQuery->SQL->Add(QueryString);
// ZQuery->RequestLive = true;
// ZQuery->Active = true;
ZQuery->Open();
AnsiString A = ZQuery->FieldByName("veld")->AsString;
// A is NULL
maybe some other usefull info:
- ik tried to use both libmysql.dll and libmysql51.dll
- when I look at the content of ZQuery->SQL->Text then I see that the value is not only my QueryString, but a \r\n is added to it. I have no idea how to get rid of the \r\n on that point and i have no idea if it has anything to do with my problem.