查看完整版本: [--
qt QSqlQuery类 中execBatch函数的使用疑问
--]
QTCN开发网
->
Qt基础编程
->
qt QSqlQuery类 中execBatch函数的使用疑问
[打印本页]
登录
->
注册
->
回复主题
->
发表主题
lihua3152000
2012-12-08 19:45
qt QSqlQuery类 中execBatch函数的使用疑问
QSqlQuery
q;
q.
prepare
("insert into myTable values (?, ?)");
QVariantList
ints;ints << 1 << 2 << 3 << 4;
q.
addBindValue
(ints);
QVariantList
names;names << "Harald" << "Boris" << "Trond" <<
QVariant
(
QVariant
::String);
q.
addBindValue
(names);
if (!q.execBatch())
qDebug
() << q.
lastError
();
上面是英文帮助中的例子,我现在想实现对表的更新,跟上面的程序类似,能够成功实现,但是数据量大时,速度有点慢。
谁能够有更快的更新数据库的方法和技术?谢谢!
xins0123
2017-01-23 16:40
启用事务
查看完整版本: [--
qt QSqlQuery类 中execBatch函数的使用疑问
--] [--
top
--]
Powered by
phpwind
v8.7
Code ©2003-2011
phpwind
Gzip disabled