首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

c++ mysql 增添数据

2012-09-08 
c++ mysql 添加数据比如string sql_cmd;for (int ind0ind100ind++){sql_cmd insert into masterSer

c++ mysql 添加数据
比如
string sql_cmd;
  for (int ind=0;ind<100;ind++)
{
sql_cmd = "insert into masterServer (id) values (ind)";
  mysql_real_query(&myCont,sql_cmd.c_str(),sql_cmd.length());
}

values 后面跟的括号里面是不是不能用变量。
要怎么样才能实现循环添加

[解决办法]
要用变量请使用
stringstream
sprintf()

自己Google用法吧。

热点排行