如何解决关闭mysql连接后,将mysql结果放入数组中使用
int i=0;
char *tariffobjChar[10][5];
stmt = odbc_direct_execute(obj,generic_execute_noFetch,sql);
while ((res = SQLFetch(stmt)) != SQL_NO_DATA && res != SQL_ERROR) {
SQLGetData(stmt,1,SQL_C_CHAR,trunkcode,sizeof(trunkcode),NULL);
//print the correct value from the SELECT
printf("truncode = %s \n",trunkcode);
//Now I need save the trunkcodes inside un array or pointer.
tariffobjChar[i][0] = id_trunk;
}
//here I need disconnect the ODBC,and need loop again per the trunccodes
for (t = 0; t < i ; ++t){
printf("truncode = %s \n",tariffobjChar[t][0]);
//but here the tariffobjChar[t][0] every show the last value of the mysql select
}
我需要关闭ODBC连接,因为在秒循环上,我将执行一个花费很多时间的大任务,并且我希望关闭odbc连接。
谢谢您的帮助
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。