Igo*_*ejc 8 c# sqlite gis spatialite
我正在尝试使用System.Data.SQLite提供程序从C#访问SpatiaLite.当我尝试加载SpatiaLite扩展时,我总是得到
System.Data.SQLite.SQLiteException: SQLite error
The specified module could not be found.
Run Code Online (Sandbox Code Playgroud)
即使已将spatialite的dll复制到bin目录,也会出现错误.我甚至尝试指定dll的绝对路径,但无济于事.
这是代码:
string connectionString = @"Data Source=D:\MyStuff\projects\OsmUtils\trunk\Data\Samples\DB\osm.sqlite";
using (SQLiteConnection connection = new SQLiteConnection (connectionString))
{
connection.Open();
using (SQLiteCommand command = connection.CreateCommand())
{
command.CommandText = @"SELECT load_extension('libspatialite-1.dll');";
command.ExecuteScalar();
}
...
Run Code Online (Sandbox Code Playgroud)
从这个链接我得到的印象应该工作.
提前致谢
好吧,多亏了sqlite3.exe命令行工具,我发现还有一些额外的DLL需要运行:
您可以在SpatiaLite的下载页面上找到这些.只需将它们复制到bin目录即可.
更新:需要一个额外的DLL是libiconv2.dll
| 归档时间: |
|
| 查看次数: |
5913 次 |
| 最近记录: |