Error loading spatialite module in C# project

495 views
Skip to first unread message

Jose Carlos Peñas

unread,
Mar 15, 2016, 6:40:12 PM3/15/16
to SpatiaLite Users

Hi everyone


I'm doing a project in C # using SpatiaLite as a database.

The problem comes loading the extension SpatiaLite on sqlite. I've loaded the extension in SpatiaLite versions 2.x but no versions 3x and 4x. The error ocurred in extension loading. I  use the following statement to load the module:


ret = new SQLiteCommand object ( "SELECT load_extension (\" mod_spatialite \ ");" sql_con_Trab) .ExecuteNonQuery ();


The exceptions are the following:

The procedure entry point gzdirect could not be located in the dynamic link library C:\borrar\spatialite\libxml2-2.dll




An unhandled exception of type 'System.Data.SQLite.SQLiteException' occurred in System.Data.SQLite.dll

Additional information: SQL logic errors or missing database

The specified process was not found.


Please help!

Yvan B

unread,
Mar 16, 2016, 4:05:10 AM3/16/16
to SpatiaLite Users
Hi Jose,

maybe you have to add the dll files of spatialite in your bin folder (debug or release) ?  
For a project in VB.NET, I put all the necessary files of spatialite in a folder and I use this statement (vb.net):

Environment.SetEnvironmentVariable("Path", *put here the path to the spatialite files*, EnvironmentVariableTarget.Process)

After that, I can use

Dim cnn As New SQLiteConnection(dbConnection)
            cnn.Open()

Yvan B

unread,
Mar 16, 2016, 4:06:48 AM3/16/16
to SpatiaLite Users
sorry my message was truncated:

So I can use

   Dim cnn As New SQLiteConnection(connectionString)
   cnn.Open()
   cnn.EnableExtensions(True)
   cnn.LoadExtension("mod_spatialite")

Yvan

Le mardi 15 mars 2016 23:40:12 UTC+1, Jose Carlos Peñas a écrit :
Reply all
Reply to author
Forward
0 new messages