当前位置:Gxlcms > 数据库问题 > C++用sqlite3_open连接打开指定数据库的小问题

C++用sqlite3_open连接打开指定数据库的小问题

时间:2021-07-01 10:21:17 帮助过:3人阅读

stdafx.h" #include "sqlite3.h" #include <iostream> using namespace std; sqlite3 * pDB = NULL; int _tmain(int argc, _TCHAR* argv[]) { //打开路径采用utf-8编码 //如果路径中包含中文,需要进行编码转换
  //指定数据库路径记得写全 并加上 分号 " ; "
int nRes = sqlite3_open("D:\\sqlite\\fuck.db;", &pDB); if (nRes != SQLITE_OK) { cout << "Open database fail: " << sqlite3_errmsg(pDB); goto QUIT; } else { cout << "打开数据库成功!" << endl; } QUIT: sqlite3_close(pDB); return 0; }

 

C++用sqlite3_open连接打开指定数据库的小问题

标签:c++   cout   style   ret   sqlite   fail   rms   pre   lse   

人气教程排行