1、使用QSqlQuery的bindValue方法编译出错,报no matching function for call to 'QSqlQuery::bindValue(const char [6], QString)'
报错代码:query.bindValue(":type", "类型");
看了书上的例子和Qt文档中的例子都是这样写的啊,语法没有错误啊。搞了半天原来是bindValue的第二个参数QVariant类型,cpp文件中没有QVariant的引用,
把#include <QVariant>加上就ok了,经验值加1,以后碰到这种问题就有经验处理了。
原文:https://blog.csdn.net/hiyohu/article/details/41747869