C++成功连接到MySQL数据库 但是无法访问?
已经成功连上if(mysql_real_connect(&mydata,"localhost","root","wangsilun","vc_sqlexample",0,...
已经成功连上
if(mysql_real_connect(&mydata,"localhost","root","wangsilun","vc_sqlexample",0,NULL,0) != NULL)
std::cout<<"database connection OK!"<<std::endl;
但是执行如下语句会出现问题
MYSQL_RES *result = NULL;
result = mysql_store_result(&mydata);
int line;
line = mysql_num_rows(result); 报告程序出错 读取位置 0x00000000 时发生访问冲突 展开
if(mysql_real_connect(&mydata,"localhost","root","wangsilun","vc_sqlexample",0,NULL,0) != NULL)
std::cout<<"database connection OK!"<<std::endl;
但是执行如下语句会出现问题
MYSQL_RES *result = NULL;
result = mysql_store_result(&mydata);
int line;
line = mysql_num_rows(result); 报告程序出错 读取位置 0x00000000 时发生访问冲突 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询