Hi

We changed our approach and for the application running on the windows 2012 we 
recompiled it with the 64 bit dll version 1.0.90.  
The application does not get the "Could not load file or assembly 
'System.Data.SQLite" error anymore.
But now I am getting an error when I try to insert data into it.


Here is the process flow:

Application copies and existing master database and renames it.  This database 
has tables and indexes defined but they are empty.

Application opens renamed database and inserts data in to and existing empty 
tables.

This works fine on servers using 2008 just not my 2012 one


We have a class that when the application make an instance of it, it creates a 
connection to the database above.
Then we call MapDataInsert to insert the data into the table.

The problem is it throws this exception now

        ERR:Map Insert error: System.InvalidOperationException: Operation is 
not valid due to the current state of the object.
   at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel 
isolationLevel)
   at System.Data.SQLite.SQLiteConnection.      1/8/2014 3:55 PM


using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SQLite;
using System.Data.SqlClient;
using System.Data;


namespace AdxofflineBuilder
{
    public class sqLiteHandler
    {
        private string m_sCnx = "";
        private SQLiteConnection cnn;

        public  sqLiteHandler(string sCnx)
        {
            m_sCnx = sCnx;
            cnn = new SQLiteConnection(m_sCnx);
            cnn.Open();
        }
        ~sqLiteHandler()
        {
            cnn.Close();
            cnn.Dispose();
        }
        public void closeSqlHandler()
        {
            cnn.Close();
            cnn.Dispose();
        }

        public void MapDataInsert(string sQuery, string sCustCode, string 
sLang, string data)
        {
            using (System.Data.SQLite.SQLiteTransaction dbTrans = 
cnn.BeginTransaction())
            {
                using (System.Data.SQLite.SQLiteCommand cmd = 
cnn.CreateCommand())
                {
                    SQLiteParameter parm;
                    cmd.Parameters.AddWithValue("@custCode", sCustCode);
                    cmd.Parameters.AddWithValue("@langCode", sLang);
                    cmd.Parameters.AddWithValue("@data", data);
                    cmd.CommandText = sQuery;

                    try
                    {
                    cmd.ExecuteNonQuery();
                    }
                    catch(SQLiteException se)
                    {
                        string s = se.ToString();
                    }
                    catch(Exception e)
                    {
                        string s = e.ToString();
                    }
                    dbTrans.Commit();
                }

            }
        }
}

thanks for the help

Jill
-----Original Message-----
From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] 
On Behalf Of Joe Mistachkin
Sent: Wednesday, January 08, 2014 4:23 PM
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] windows 2012 server having problems loading sqllite dll


Jill Taylor wrote:
>
> I hope someone has ran across this and can give me some pointers.
>

Is System.Data.SQLite being used in an ASP.NET application?

Typically, the "setup" packages should not be used for server deployments; 
instead, the System.Data.SQLite binaries should be deployed via XCOPY (i.e.
"application locally).  The download page has further details on this type of 
deployment:

        
https://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

In this case, the "Using Native Library Pre-Loading" section merits special 
attention as 32-bit/64-bit differences are likely the root cause of the current 
issue you are seeing.

>
> Could not load file or assembly 'System.Data.SQLite, Version=1.0.66.0, 
> Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its 
> dependencies. An attempt was made to load a program with an incorrect 
> format.
>

This causes of this error message are covered by the FAQ:

        https://system.data.sqlite.org/index.html/doc/trunk/www/faq.wiki

--
Joe Mistachkin

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to