• 12523阅读
  • 0回复

【原创】qt中调用存储过程 [复制链接]

上一主题 下一主题
离线yfy002
 

只看楼主 倒序阅读 楼主  发表于: 2005-08-29
写了个存储过程,准备使用qt调用,数据库是sqlserver 2000按照参考文档
调用是下面这样的
QSqlQuery query;
query.prepare("CALL InsertImgEntity( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
query.bindValue(0,datano);
query.bindValue(1,DataCorner);
query.bindValue(2,DataZD);
query.bindValue(3,DataCommon);
query.bindValue(4,ImgCode);
query.bindValue(5,ImgCodeZ);
query.bindValue(6,"png");
query.bindValue(7,pngImage,QSql::Binary);
query.bindValue(8,"GoldMap Gaoyong Sun");
query.bindValue(9,QDateTime::currentDateTime ());

但是我在windows下却无法调用成功。调试跟踪,发觉我在调试中存储过程是通过exec调用的,故此将代码修改如下,问题解决,造成这种结果的原因可能是数据库的不同吧。
query.prepare("exec InsertImgEntity ?, ?, ?, ?, ?, ?, ?, ?, ?, ?");
query.bindValue(0,datano);
query.bindValue(1,DataCorner);
query.bindValue(2,DataZD);
query.bindValue(3,DataCommon);
query.bindValue(4,ImgCode);
query.bindValue(5,ImgCodeZ);
query.bindValue(6,"png");
query.bindValue(7,pngImage,QSql::Binary);
query.bindValue(8,"GoldMap Gaoyong Sun");
query.bindValue(9,QDateTime::currentDateTime ());
[ 此贴被XChinux在2005-08-29 14:10重新编辑 ]
我渴望平静,风却给了我涟漪
我的blog:
http://sungaoyong.cublog.cn
快速回复
限100 字节
 
上一个 下一个