vs2010连接SQLite Open()时报错

wyscs0000 2012-05-10 02:31:29
我加载了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

求解!!
...全文
321 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
dalmeeme 2012-05-18
  • 打赏
  • 举报
回复
连接字符串不合法,Data Source=f:\\aa\\server.db;Version=3;Pooling=true
  • 打赏
  • 举报
回复
这个错误是你没连接到数据库。
你改成这样试试。
String ^ConnectionString ="data source= f:\\aa\\server.db";

110,535

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧