日期:2014-05-18  浏览次数:20963 次

vs2010连接SQLite Open()时报错
我加载了SQLite的 .dll文件 想打开数据库操作的(语法是 托管C++)

  下面是代码的一部分 运行到 con->Open()的时候报错

String ^ConnectionString ="Dirver={ Navicat for SQLite (*.DB)};DBQ= f:\\aa\\server.db;";

if(!System::IO::File::Exists(ConnectionString))
{ SQLiteCommand ^dbc = gcnew SQLiteCommand();
SQLiteConnection ^con = gcnew SQLiteConnection(ConnectionString);
con->Open();

错误是:An unhandled exception of type 'System.ArgumentException' occurred in System.Data.SQLite.dll

Additional information: Data Source cannot be empty. Use :memory: to open an in-memory database

求解!!

------解决方案--------------------
这个错误是你没连接到数据库。
你改成这样试试。
String ^ConnectionString ="data source= f:\\aa\\server.db";

------解决方案--------------------
连接字符串不合法,Data Source=f:\\aa\\server.db;Version=3;Pooling=true