#include "./Mysql_/Mysql_.h"
#pragma comment(lib,"./Mysql_/libmysql.lib")
#include <iostream>
using namespace std;
int main()
{
const char *host = "localhost";
const char *user = "root";
const char *passwd = "123456";
unsigned int port = 3306;
Mysql_ mysql_;
if (mysql_.Connect_Mysql(host, user, passwd, NULL, port, NULL, 0))
{
cout << "链接成功" << endl;
char 品种_代码[100] = { "hhhhh" };
mysql_.Crete_Database_Mysql(品种_代码);//创建数据库
mysql_.Crete_Table_Mysql(品种_代码, "a1", "id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,TradingDay char(9),time char(7),open float,high float,low float,close float,vol int,OpenInterest int,Settlement float");//品种指数
mysql_.Crete_Table_Mysql(品种_代码, "a2", "id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT,TradingDay char(9),time char(7),open float,high float,low float,close float,vol int,OpenInterest int,Settlement float");//主连
}
else
{
cout << "链接失败" << endl;
}
getchar();
}
/*
1,VS项目所用位数要与mysql安装的位数一致
2,引用的头文件和dll lib 都是从mysql安装位置复制而来,也就是说 头文件和库只能用安装的mysql的版本的,不能跨版本(不知道高版本的头文件和DLL能不能调用低版本mysql)
3,经测试mysql 8.0.23.0 64位版本的头文件 和dll lib 竟然成功链接-5.7.20 32位的mysql,难道它是高版本向低版本兼容的吗
*/
本站下载 https://download.csdn.net/download/qq_30121869/14933263