MySQL Forums
Forum List  »  Connector/C++

PreparedStatement can't work?
Posted by: ray lei
Date: June 16, 2014 12:49AM

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.

Options: ReplyQuote


Subject
Views
Written By
Posted
PreparedStatement can't work?
2267
June 16, 2014 12:49AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.