You should be checking the lock after the end of the using. I think the
dispose is not done because you are still inside the using statement. Also I
think it could take some time even after the using, because I think .net CLR
can take it's time collecting it.

Also I don't think you need/should use the interop version. I would download
the latest lib and change the reference and give it a try.



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Thursday, June 20, 2013 11:12 AM
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] SQLite C# differences between Windows Server 2008 and
2003

Sure here is the code.

using (SQLiteConnection sql_con = new SQLiteConnection("Data
Source=C:\\Path\\To\\File\\docuidb.db;"))
        {
            sql_con.Open();
            SQLiteCommand sql_cmd = sql_con.CreateCommand();
            string CommandText = "update MyTable set field1='test',
field2='test', field3='test' WHERE field4='field4';
            sql_cmd.CommandText = CommandText;
            sql_cmd.ExecuteNonQuery();
            sql_cmd.Dispose();
            sql_con.Close();
            sql_con.Dispose();
                //this just checks to see if it is locked or not and returns
the result.
            try { FileStream fs =
File.Open("C:\\Path\\To\\File\\docuidb.db", FileMode.Open); fs.Close(); }
            catch(Exception e){result = e.Message.ToString();}
        }

I am not sure about the SQLite.Interop.dll, when I remove the file it
compiles fine, but when I go to run it I get:

System.DllNotFoundException: Unable to load DLL 'SQLite.Interop.dll': The
specified module could not be found. (Exception from HRESULT: 0x8007007E)
   at
System.Data.SQLite.UnsafeNativeMethods.sqlite3_config_none(SQLiteConfigOpsEn
um op)
   at System.Data.SQLite.SQLite3.StaticIsInitialized()
   at System.Data.SQLite.SQLiteLog.Initialize()
   at System.Data.SQLite.SQLiteConnection..ctor(String connectionString)
   at Service.myService

Is this not the correct way to go about using the dll in the code?  This was
originally built by someone who is not here anymore, so I cannot tell you
the reasoning behind doing it this way.  Thank you for looking at this.

James Johnston

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of eschneider FE
Sent: Thursday, June 20, 2013 10:37 AM
To: 'General Discussion of SQLite Database'
Subject: Re: [sqlite] SQLite C# differences between Windows Server 2008 and
2003

Can you post the code?

And why do you need to use the SQLite.Interop.dll ?

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Thursday, June 20, 2013 9:59 AM
To: '[email protected]'
Subject: [sqlite] SQLite C# differences between Windows Server 2008 and 2003

Hello,

  I am using System.Data.SQLite.dll version 1.0.82.0 and SQLite.Interop.dll
to connect to some SQLite databases using C# Web Services.  The code is
working fine on Windows Server 2008, but on 2003 it is not releasing the
database at the end of the call.  It is extremely simple code, just to
connect, update a record, then close and dispose is being called.  I have
tried a using(){}, which should automatically call the close and dispose as
well as a try{ExecuteNonQuery()}finally{Close()}, but for some reason that
database file remains locked well after the script has ran.  Sometimes it
can take a few seconds up to a few minutes to close on the 2003 server(which
works fine on the 2008 server).  It might just be some setting for the IIS
Worker Process, but I don't know where else to look.  If I manually end the
w3wp.exe, it will then release the file back to the computer.  Has anyone
ran into this issue?  What other settings should I look for?  Let me know
when you get a chance, and I lo
   ok forward to hearing back.

James Johnston
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to