StupidBeauty
Read times:467Posted at:Sun May 6 22:51:41 2012
- no title specified

转载:Qt4访问sqlite数据库

SQLite一个文件即是一个数据库,方便。

http://www.cnblogs.com/bennylam/archive/2010/03/22/1691355.html

亮点:

QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE"); //使用sqlite数据库驱动
db.setDatabaseName("test"); //我们之前建立的数据库
bool ok = db.open(); //尝试连接数据库
if (ok)
{ //这里用text已经成功连上数据库
QSqlQuery query; //新建一个查询的实例
if (query.exec("select * from student")) //尝试列出 student 表的所有记录
{ //本次查询成功
int numRows = 0; //询问数据库驱动,是否驱动含有某种特性
if (db.driver()->hasFeature(QSqlDriver::QuerySize))

Your opinions
Your name:Email:Website url:Opinion content:
- no title specified

HxLauncher: Launch Android applications by voice commands

 
Recent comments
2017年4月~2019年4月垃圾短信排行榜Posted at:Thu Sep 26 04:51:48 2024
Qt5.7文档翻译:QWebEngineCookieStore类,QWebEngineCookieStore ClassPosted at:Fri Aug 11 06:50:35 2023盲盒kill -9 18289 Grebe.20230517.211749.552.mp4