我正尝试从c#应用程序连接到sqllite db。我从来没有使用过SQLLite。如何从c#连接到SQLite数据库文件?
var connectionString = @"data source='C:\TestData\StressData.s3db'";
connection = new SQLiteConnection(connectionString);
connection.Open();
当我试图打开我得到下面的异常连接:
System.NotSupportedException: The given path's format is not supported.
at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
我在做什么错?
谢谢..
尼克
更新:
我改变了 '数据源' 到 '数据源' 的建议给我。现在我收到一个新的错误:
更改后,我得到一个新的错误:System.ArgumentException:数据源不能为空。使用:内存:打开内存数据库在System.Data.SQLite.SQLiteConnection.Open()
有更多建议吗?
尝试删除连接字符串中的撇号DataSource参数:'@“DataSource = c:\ TestData \ StressData.s3db”'。 – 2010-06-14 17:07:39