我正在尝试从c#应用程序连接到sqllite数据库。我以前从未使用过SQLLite。
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)
我做错了什么?
谢谢。
Nick
更新:
像建议给我的那样,我将“data source”更改为“DataSource”。现在我收到一个新错误:
更改后,我收到一个新错误:System.ArgumentException:数据源不能为空。使用:memory:打开内存数据库 at System.Data.SQLite.SQLiteConnection.Open()
还有其他建议吗?
@"DataSource=c:\TestData\StressData.s3db"
。 - Will Marcouiller