gpt4 book ai didi

c++ - 连接器 c++ res->getBoolean 访问冲突

转载 作者:太空宇宙 更新时间:2023-11-04 13:43:22 24 4
gpt4 key购买 nike

我在 Visual Studio 2013 中使用 mysql-connector-c++-1.1.4-winx64。连接到特定数据库并读取整数值是可行的,但无法检索任何 bool 值。
我可以编译包含附加代码的程序,但程序关闭检索:

"The program '[3480] Project1.exe: Managed (v4.0.30319)' has exited with code -1073741819 (0xc0000005) 'Access violation'."

感谢您的帮助!

                                    const char* idQuery = "SELECT EXISTS (SELECT id FROM experiment_results WHERE id='22');";
stmt = con->createStatement();
stmt->execute(idQuery);
while (res->next())
{
bool flag = res->getBoolean(1);
}

最佳答案

再次查看代码后,我发现我的错误:stmt->执行(idQuery);//应该:res = stmt->executeQuery(idQuery);

关于c++ - 连接器 c++ res->getBoolean 访问冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26927695/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com