VS2022 使用C++访问 mariadb 数据库

作者 : admin 本文共317个字,预计阅读时间需要1分钟 发布时间: 2024-06-16 共1人阅读

首先,下载 MariaDB Connector/C++  库

MariaDB Products & Tools Downloads | MariaDB

VS2022 使用C++访问 mariadb 数据库插图

第二步,安装后 

VS2022 使用C++访问 mariadb 数据库插图(1)

第三步,写代码

#include  
#include 
#include 
#include 

#include 

std::string utf8_to_gbk(const std::string& utf8_str) {
	if (utf8_str.empty()) return "";

	// 1. 计算需要的宽字符数组的大小
	int wideCharCount = MultiByteToWideChar(CP_UTF8, 0, utf8_str.c_str(), -1, NULL, 0);
	if (wideCharCount == 0) {
		retur
本站无任何商业行为
个人在线分享 » VS2022 使用C++访问 mariadb 数据库
E-->