QT连接FireBird测试

Stella981
• 阅读 709
#include "QSqlDatabase.h"
#include "QMessageBox.h"
#include <QSqlError>
#include <QSqlQuery>
 
 QStringList a = QSqlDatabase::drivers();
 QMessageBox::information(NULL, "", a.join("_"));
 QSqlDatabase db = QSqlDatabase::addDatabase("QIBASE");
 db.setHostName("localhost");
 db.setUserName("sysdba");
 db.setPassword("masterkey");
 db.setDatabaseName("D:\\FBDatabase\\Test.fdb");
 if(!db.isValid())
 {
  QString lastError = db.lastError().text();
  QMessageBox::information(NULL, "", lastError);
 }
 if(!db.open())
 {
  QMessageBox::information(NULL, "","Error");
 }
 QSqlQuery qry = QSqlQuery("Select Count(*) From PERSON");
 qry.exec();
 qry.next();
 QMessageBox::information(NULL, "", qry.value(0).toString());
点赞
收藏
评论区
推荐文章
Easter79 Easter79
2年前
springCloud 搭建eureka服务之天坑
这里我是采用gradle来管理jar包的。1、使用idea创建一个gradle项目。2、编辑settings.gradle文件rootProject.name'jtm'//include'jtm_core'//include'jtm_sys'//include'jtm_eureka'
Wesley13 Wesley13
2年前
PLA感知学习算法
1include<vector2include<iomanip3include<string4include<stdio.h5include<string.h6include<fstream7include<ios
Wesley13 Wesley13
2年前
OpenCV图像亮度、对比度调节
include "cv.h"    include "highgui.h"    include <stdio.h    int ImageAdjust(IplImage src,IplImage dst,                    double 
Stella981 Stella981
2年前
Pthreads 信号量,路障,条件变量
▶使用信号量来进行线程间信息传递●代码1include<stdio.h2include<pthread.h3include<semaphore.h4pragmacomment(lib,"pthreadVC2.lib")56constint
Wesley13 Wesley13
2年前
72.挖掘CSDN密码到链表并统计密码出现次数生成密码库
list.h1define_CRT_SECURE_NO_WARNINGS2include<stdio.h3include<stdlib.h4include<string.h56//创建密
Wesley13 Wesley13
2年前
2.任务包多线程并行计算
1include<future//进程通信,获取未来的结果2include<iostream3include<thread4include<string5include<chrono//时间6include<mutex//互斥量7
Stella981 Stella981
2年前
AtCoder Beginner Contest 132 F
数sqrt缩小范围整除分块1include<cstdio2include<cstdlib3include<cmath4include<cstring5include<string6include<algorithm
Stella981 Stella981
2年前
Linux IO多路复用之epoll网络编程基本代码
server端:include<unistd.hinclude<sys/types.h/basicsystemdatatypes/include<sys/socket.h/basicsocketdefinitions/include<n
Wesley13 Wesley13
2年前
C语言学生管理系统(原版本)(自编)
/系统特色:(大牛勿笑)  颜色提示  文字提示  功能/1include<stdio.h2include<stdlib.h3include<math.h4include<string.h5
Stella981 Stella981
2年前
PAT A1015Reversible Primes(可逆素数)
主要考察了判断一个10进制数是否为素数(isZS(intss))和怎么求一个十进制数的n进制数rec(intn,intm)代码:1include<cstdio2include<algorithm3include<iostream4include<string5