我正在尝试使用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();
}
...
从这个链接上看,我认为这应该可以解决问题。
提前感谢。