in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

Connection error

Last post 12-24-2009 10:23 AM by amw403. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 07-22-2009 2:00 AM

    Connection error

    I am using ADO.NET provider installed by "SQLite-1.0.64.0-setup.exe".

    I am developing client application using VS2008 and compact framework 3.5. Here is the code

    using System.Data.SQLite;

    public class GlobalDFinderMethods

    {

    private static SQLiteConnection sql_con;

    private static SQLiteCommand sql_cmd;

    private static SQLiteDataAdapter DB;

    private static DataSet dsSQLite = new DataSet();

    private static DataTable dtSQLite = new DataTable();private static void SetConnection()

    {

    sql_con = new SQLiteConnection

    ("Data Source=MApp.db;Version=3;New=False;Compress=True;");

    }

    public static void ExecuteQuery(string txtQuery)

    {

    SetConnection();

    sql_con.Open();

    sql_cmd = sql_con.CreateCommand();

    sql_cmd.CommandText = txtQuery;

    sql_cmd.ExecuteNonQuery();

    sql_con.Close();

    }

     

    I get error "Can't find PInvoke DLL 'SQLite.Interop.064.DLL'" when I tried to run the application on WM 6 Professional emulator on sql_con.Open(); statement.

    I tries to add reference of "SQLite.Interop.064.DLL" file from "C:\Program Files\SQLite.NET\bin\CompactFramework", but VS 2008 does not allow me to do that. 

     Please help me out.

  • 07-22-2009 4:49 AM In reply to

    Re: Connection error

    I think the solution in the link below should fix your problem

    http://sqlite.phxsoftware.com/forums/p/1812/7766.aspx#7766

  • 07-22-2009 7:30 AM In reply to

    Re: Connection error

    Once you've deployed the interop  DLL to the device, the next problem you're going to encounter is the fact that you haven't specified the full path to the DB in your connection string.  Windows Mobile has no concept of "current directory", so you must always specify the full path in the connection string.  Personally, I do it this way:

    "Data Source=|DataDirectory|MApp.db"

    |DataDirectory| gets expanded at runtime to be the path where your application resides.

     

  • 12-24-2009 10:23 AM In reply to

    Re: Connection error

     

    http://sqlite.phxsoftware.com/forums/t/1569.aspx

     

    try the 7th post...

    ^_^

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems