[Resolved Wrong results in example 2.
I think i used a wrong version of "libmysql.dll". So sry. :D
=============================================================================
Sorry for my English.
I got the same problem with this topic:
http://forums.mysql.com/read.php?167,298946,298946
First, the placeholder syntax seem not work:
Code:
==========================================================================
pstmt = con->prepareStatement("INSERT INTO test(id) VALUES (?)");
for (int i = 1; i <= 10; i++) {
pstmt->setInt(1, i);
pstmt->executeUpdate();
}
==========================================================================
All of id values are 0. I think they should be 1 to 10.
And the second is result of:
Code:
==========================================================================
/* Select in ascending order */
pstmt = con->prepareStatement("SELECT id FROM test ORDER BY id ASC");
res = pstmt->executeQuery();
/* Fetch in reverse = descending order! */
res->afterLast();
while (res->previous())
cout << "\t... MySQL counts: " << res->getInt("id") << endl;
==========================================================================
I got 10 of -1163005939 values instead 10 to 1.
I don't know why the topic above had no reply and was locked. I'm new of SQL and my English is bad, but please help me.
Thank you.
Edited 6 time(s). Last edit at 05/09/2012 02:32AM by Phuc Sinh Nguyen.