懂SQLite的高手们,我在程序中用sqlite3_open语句打开数据库如下: 
  sqlite3 *db=NULL; 
  char *zErrMsg = 0; 
  int rc=0; 
  CString dbPath=strPath+"\\Result.db"; 
  rc = sqlite3_open(dbPath, &db); 
  if(rc) 
  { 
    sqlite3_close(db); 
    return; 
  } 
  程序运行后看不到用了数据库中数据,于是断点跟了一下,发现rc值为14,这是一个错误代码,我也不知道错在什么地方了,我的dbPath路径(strPath为该段代码所在函数形参)下确实是有Result.db数据库文件阿? 

解决方案 »

  1.   

    #define SQLITE_CANTOPEN    14   /* Unable to open the database file */
      

  2.   

    确保打开之前数据库文件等已经被正确关闭sqlite3_close(db); 
      

  3.   

    http://archives.devshed.com/forums/databases-124/random-error-sqlite-cantopen-on-windows-xp-sp2-with-sqlite3t-1833893.html
      

  4.   

    先答应 dbPath ,检查路径,其次检查你打开前的代码,是否没有正确关闭db...
      

  5.   

    貌似改成全英文路径就不出现问题了,第一个参数好像要求是UTF-8,那么怎样才能使用有中文的路径呢?能不能转换为GB2312?