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