I am trying to use Spatialite in a .NET application using the System.Data.SQLite provider.
I have tried to load 'libspatialite-2.dll' but an error happens when I call function "ExecuteStatement(@"SELECT load_extension('libspatialite-2.dll')", connection);" The specific error is "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." I am using VS2008 SP1, .net Framework 3.5 SP1, Windows7 64bit. Here's my source code : class Program { const string mydb = @"d:\world.sqlite"; static void Main(string[] args) { using (SQLiteConnection connection = new SQLiteConnection(@"Data Source=" + mydb)) { connection.Open(); ExecuteStatement(@"PRAGMA foreign_keys = ON", connection); ExecuteStatement(@"SELECT load_extension('libspatialite-2.dll')", connection); } } private static void ExecuteStatement(string statement, SQLiteConnection connection) { using (SQLiteCommand command = new SQLiteCommand(statement, connection)) { command.ExecuteNonQuery(); } } } < error message > : System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) System.Data.SQLite.SQLiteDataReader.NextResult() System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave) System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior) System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() ConsoleApplication1.Program.ExecuteStatement(String statement, SQLiteConnection connection) file C:\Users\Mitch\Desktop\TEST \ConsoleApplication1\ConsoleApplication1\Program.cs: line 36 ConsoleApplication1.Program.Main(String[] args) file C:\Users\Mitch \Desktop\TEST\ConsoleApplication1\ConsoleApplication1\Program.cs:line 28 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) System.Threading.ThreadHelper.ThreadStart()</ StackTrace><ExceptionString>System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt System.Data.SQLite.UnsafeNativeMethods.sqlite3_step(IntPtr stmt) -- You received this message because you are subscribed to the Google Groups "SpatiaLite Users" group. To post to this group, send email to spatialite-us...@googlegroups.com. To unsubscribe from this group, send email to spatialite-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/spatialite-users?hl=en. -- Mitch Shin C + 82 18 224 7907 E cornhea...@gmail.com _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users