当前位置:网站首页>QT读取SQLserver数据库
QT读取SQLserver数据库
2022-06-13 07:19:00 【CSDN问答】
QT框架读取目标数据库
#include "mainwindow.h"
#include "mainwindow.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include <stdio.h>
bool createConnection()
{
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");
db.setHostName("182.151.6.159");
db.setPort(3306);
db.setDatabaseName("BDUMeauData");
db.setUserName("sa");
db.setPassword("MRznkj136");
db.setDatabaseName("SELECT*FROM dbo.BDU_3测试");
bool ok = db.open();
if (ok)
{
qDebug() << "连接成功" ;
}
else
{
qDebug() << "连接失败" ;
}
return 1;
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
if (!createConnection())
return 1;
return a.exec();
}
15:23:18: Starting F:\c++Learn\build-ReadMysql-Desktop_Qt_5_12_11_MinGW_64_bit-Release\release\ReadMysql.exe ...
[LspTrace]process path is F:\c++Learn\build-ReadMysql-Desktop_Qt_5_12_11_MinGW_64_bit-Release\release\ReadMysql.exe
[LspTrace]ReadAccConfig returns false!
[LspTrace]FindMatchingProvider: inInfo is one of the LSPs entry.
[LspTrace]WSPStartup end: 0, protocol=6, [not] hook
连接失败
15:23:18: Starting F:\c++Learn\build-ReadMysql-Desktop_Qt_5_12_11_MinGW_64_bit-Release\release\ReadMysql.exe ...
[LspTrace]process path is F:\c++Learn\build-ReadMysql-Desktop_Qt_5_12_11_MinGW_64_bit-Release\release\ReadMysql.exe
[LspTrace]ReadAccConfig returns false!
[LspTrace]FindMatchingProvider: inInfo is one of the LSPs entry.
[LspTrace]WSPStartup end: 0, protocol=6, [not] hook
连接失败
抄的代码,不知道QT怎么读取数据库
帮助解决怎么读
边栏推荐
猜你喜欢

Micro isolation (MSG)

测试开发程序员,你还在迷茫吗?不能把自己定义为码农......

百货中心供应链管理系统
![[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution](/img/8a/e6423168e110a168bc3cc6407628f6.png)
[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution

Detailed description of drawing ridge plot, overlapping densities of overlapping kernel density estimation curve, facetgrid object and function sns Kdeplot, function facetgrid map

Ticdc introduction

Br backup test

RT thread simulator lvgl control: button button style

FSM状态机

Powerdispatcher reverse generation of Oracle data model
随机推荐
基于FPGA的ds18b20温度传感器使用
powerdisgner逆向生成oracle数据模型
全志V3S环境编译开发流程
Detailed description of drawing ridge plot, overlapping densities of overlapping kernel density estimation curve, facetgrid object and function sns Kdeplot, function facetgrid map
Priority analysis of list variables in ansible playbook and how to separate and summarize list variables
It's called the next generation monitoring system. Let's see how awesome it is
领先企业的管理实践证明,企业可持续发展的核心是什么?
How to write an amazing design document?
c#高级编程-特性篇
Department store center supply chain management system
FTP_ Manipulate remote files
How worker threads in the thread pool are recycled
Powerdispatcher reverse generation of Oracle data model
An example of CSRF attack defense in web application scenarios
【RS-422与RS-485】RS-422与RS-485串行接口标准
Related operations under Oracle Database
C Advanced Programming - features
Yolov5 analysis | parameters and performance indicators
10 Honest Facts I Want To Share With All Junior Developers
Ticdc introduction