- 論壇徽章:
- 0
|
測試程序如下
try{
Connection * conn;
Statement * stmt;
char connstr[] = "dev;dev123";
Environment* env;
env = Environment::createEnvironment();
conn = env->createConnection("dev","dev123");
stmt = conn->createStatement();
stmt->setSQL("update mhb_test set id=6 where name=:1");
string str("dkk");
stmt->setString(1,str);
//stmt->setInt(1,6);
int res = stmt->executeUpdate();
conn->commit();
printf("update %d rows\n",res);
}catch (SQLException &sqlExcp)
{
DB_LOG_ERROR("[%s][%d]errcode=%d %s\n",__FILE__,__LINE__,sqlExcp.getErrorCode(),sqlExcp.getMessage().c_str());
return 1;
}
執(zhí)行后打印 update 0 rows 數(shù)據(jù)庫沒變化 |
|