SQLite的+ SpatiaLite问题 [英] SQLite + SpatiaLite problems

查看:1502
本文介绍了SQLite的+ SpatiaLite问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图访问使用System.Data.SQLite提供C#中SpatiaLite。当我尝试加载SpatiaLite延伸,我总是得到

I'm trying to access a SpatiaLite from C# using System.Data.SQLite provider. When I try to load the SpatiaLite extension, I always get the

System.Data.SQLite.SQLiteException: SQLite error
The specified module could not be found.



错误,即使spatialite的DLL已经复制到bin目录。我甚至尝试指定该DLL的绝对路径,但无济于事。

error, even though the spatialite's dll has been copied to the bin directory. I even tried specifying the absolute path to the dll, but to no avail.

下面的代码:

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();
    }
    ...



从的this链接给我的感觉这应该工作。

From this link I get the impression this should work.

在此先感谢

推荐答案

好感谢sqlite3.exe命令行工具,我发现有一些额外的DLL运行需要这样的:

Well thanks to sqlite3.exe command line tool, I've found out that there are some additional DLLs needed for this to run:


  • libproj-0.dll

  • libgeos-3-1- 1.DLL

  • libgeos_c-1.DLL

您可以找到这些上的 SpatiaLite的下载页面。 。把它们复制到bin目录

You can find these on SpatiaLite's download page. Just copy them to the bin directory.

更新:需要一个额外的dll为 libiconv2.dll

UPDATE: one additional dll needed is libiconv2.dll

这篇关于SQLite的+ SpatiaLite问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆