登录 注册
当前位置:主页 > 资源下载 > 50 > MySQL 5.7.24版本的DLL库文件

MySQL 5.7.24版本的DLL库文件

  • 更新:2024-07-11 21:50:20
  • 大小:8.15MB
  • 推荐:★★★★★
  • 来源:网友上传分享
  • 类别:MySQL - 数据库
  • 格式:ZIP

资源介绍

mysql库文件和头文件,可以用VC调用库函数 #include "stdafx.h" #include "mysql.h" #include #include < list > #pragma comment(lib,"libmysql.lib") using namespace std; int main() { char strSQL[256] = { 0 }; MYSQL mysql; mysql_init(&mysql;); char* host = "localhost"; char* user = "root"; char* pwd = ""; char* dbname = "test"; int port = 3306; if (!mysql_real_connect(&mysql;, host, user, pwd, dbname, port, NULL, 0)) { printf("%s\n", mysql_error(&mysql;)); printf("connect failed\n"); return 1; } // query char* tbname = "student"; sprintf(strSQL, "select * from %s", tbname); if (mysql_real_query(&mysql;, strSQL, strlen(strSQL))) { printf("%s\n", mysql_error(&mysql;)); printf("read failed!\n"); mysql_close(&mysql;); return 2; } //get result MYSQL_RES* result; if (!(result = mysql_use_result(&mysql;))) { printf("%s\n", mysql_error(&mysql;)); printf("read result failed!\n"); mysql_close(&mysql;); return 3; } //show data MYSQL_ROW row; int num = mysql_num_fields(result);// field number while (row = mysql_fetch_row(result)) { for (int i = 0; i < num; ++i) printf("%s\t", row[i]); printf("\n"); } mysql_free_result(result); mysql_close(&mysql;); system("Pause"); return 0; }