我正在尝试使用 System.Data.SQLite 提供程序从 C# 访问 SpatiaLite。当我尝试加载 SpatiaLite 扩展时,我总是得到
System.Data.SQLite.SQLiteException: SQLite error
The specified module could not be found.
错误,即使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();
}
...
From 这个链接 http://groups.google.com/group/spatialite-users/browse_thread/thread/63ceedd2da9b2ae1我的印象是这应该有效。
提前致谢
多亏了 sqlite3.exe 命令行工具,我发现运行它还需要一些额外的 DLL:
- libproj-0.dll
- libgeos-3-1-1.dll
- libgeos_c-1.dll
您可以在以下位置找到这些内容SpatiaLite 的下载页面 http://www.gaia-gis.it/gaia-sins/。只需将它们复制到 bin 目录即可。
UPDATE:还需要一个额外的 dll 是libiconv2.dll
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)