当前位置:网站首页>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怎么读取数据库
帮助解决怎么读
边栏推荐
- RT thread simulator lvgl control: button button event
- 2022 - 06 - 12: dans un échiquier carré n * N, il y a n * n pièces, donc chaque pièce peut avoir exactement une pièce. Mais maintenant quelques pièces sont rassemblées sur une grille, par exemple: 2 0
- Br tool backup recovery
- Fe of mL: introduction to vintage curve /vintage analysis, calculation logic and detailed introduction to case application
- Ticdc introduction
- oracle问题,字段里面的数据被逗号隔开,取逗号两边数据
- 尝试使用RenderDoc查看UE的Shader代码
- [hard copy] core differences among dirty reading, non repeatable reading and unreal reading scenarios
- MySQL query timeout control
- MySQL does not recommend setting the column default value to null. Why on earth is this
猜你喜欢
WWDC2022最大的亮点: MetalFX
First day of learning MySQL Basics
Tikv key performance parameters and optimization
[vivefocus uses the wavevr plug-in to obtain handle operation events]
SDN基本概述
怎么写出一份令人惊叹的设计文档?
Tidb grafana reverse proxy
[RS-422 and RS-485] RS-422 and RS-485 serial interface standard
C # related knowledge points
Learning notes of MySQL series by database and table
随机推荐
2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
How to write an amazing design document?
ISIS的vsys(虚拟系统)
检测循环数“142857“
Word document export
Local file upload FTP or remote directory
[cloud native | kubernetes] kubernetes configuration
Calculate running total / running balance
MySQL does not recommend setting the column default value to null. Why on earth is this
mysql中时间字段 比较时间大小
RT-Thread 模拟器 simulator LVGL控件:slider 控件
怎么写出一份令人惊叹的设计文档?
2022 - 06 - 12: dans un échiquier carré n * N, il y a n * n pièces, donc chaque pièce peut avoir exactement une pièce. Mais maintenant quelques pièces sont rassemblées sur une grille, par exemple: 2 0
Department store center supply chain management system
Ticdc introduction
尝试使用RenderDoc查看UE的Shader代码
Que se passe - t - il si les produits financiers sont nuls pendant plusieurs jours?
An example of CSRF attack defense in web application scenarios
[Tencent Alibaba's most comprehensive collection of test questions] (four sides: three rounds of technology +1 round of HR)
数字时代进化论