Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

[Resolved Wrong results in example 2. (no replies)

$
0
0
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.

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>