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

PreparedStatement can't work? (no replies)

$
0
0
Hi all, I am a new comer for mysql connector/c++ user. The PreparedStatement can't working in my project, but statement was fine. I had search so much time but no result for it.

Version: mysql 5.0.18, connector c++, 1.0.5

Database table struct:
table name : city,
name varchar(20)
country varchar(20)

code:

pstmt=con->prepareStatement("insert into city(name, country) values(?,?)");
pstmt->setString(1, "Beijing1");
pstmt->setString(2, "China2");
//pstmt->execute();
pstmt->executeUpdate();

after running, a record which name is 0, country is NULL will be inserted into city.

Who can explain it for me, Thanks.

Viewing all articles
Browse latest Browse all 527

Trending Articles



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