Nic*_*ick 11 c# database sqlite ado.net connection-string
我正在尝试使用ac#application连接到sqllite数据库.我之前从未使用过SQLLite.
var connectionString = @"data source='C:\TestData\StressData.s3db'";
connection = new SQLiteConnection(connectionString);
connection.Open();
Run Code Online (Sandbox Code Playgroud)
当我尝试打开连接时,我得到以下异常:
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)
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
谢谢..
缺口
更新:
我按照建议将"数据源"更改为"DataSource".现在我收到一个新错误:
更改此内容后,我收到一个新错误:System.ArgumentException:Data Source不能为空.使用:memory:在System.Data.SQLite.SQLiteConnection.Open()中打开内存数据库
还有什么建议吗?
Nic*_*ick 13
得到它了..
"data source=c:\TestData\StressData.s3db; Version=3;"
Run Code Online (Sandbox Code Playgroud)
看起来"版本"属性不是可选的.有趣的是.NET提供程序没有在设计器属性窗口中显示它.
| 归档时间: |
|
| 查看次数: |
40311 次 |
| 最近记录: |