QsqlDatabase db = QsqlDatabase::addDatabase("QsqlITE"); db.setDatabasename("support"); if(!db.open()) { QMessageBox::critical(0,qApp->tr("Cannot open database"),qApp->tr("Unable to establish a database connection.\n" "This example needs sqlite support. Please read " "the Qt sql driver documentation for information how " "to build it.\n\n" "Click Cancel to exit."),QMessageBox::Cancel); return false; } Qsqlquery q; q.exec("create table student(ID integer primary key,name varchar,age integer)"); q.exec("insert into student(ID,name,age) values(1001,'AnPan',21)"); q.exec("insert into student(ID,age) values(1002,'CaolL',22)"); return true;
以上是内存溢出为你收集整理的SQLITE数据库全部内容,希望文章能够帮你解决SQLITE数据库所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)