If you showed a small sample code that caused your problem it would sure help a
lot.
I peeked at the library code. That message is generated when _cnn is null (the
DB connection).
private void InitializeForReader()
{
if (_activeReader != null && _activeReader.IsAlive)
throw new InvalidOperationException("DataReader already active on this
command");
if (_cnn == null)
throw new InvalidOperationException("No connection associated with this
command");
It is set on a "new Connection".
It is only turned to null in one place (in Commit). But why in the world you
would null _cnn on a commit is beyond me.
Are you using a commit? It could be autocommit I supposed causing it.
I'd comment out that "_cnn = null" line below and see if it solves your
problem. Sure would explain why it only works once.
/// <summary>
/// Commits the current transaction.
/// </summary>
public override void Commit()
{
IsValid(true);
if (_cnn._transactionLevel - 1 == 0)
{
using (SQLiteCommand cmd = _cnn.CreateCommand())
{
cmd.CommandText = "COMMIT";
cmd.ExecuteNonQuery();
}
}
_cnn._transactionLevel--;
_cnn = null;
}
Michael D. Black
Senior Scientist
NG Information Systems
Advanced Analytics Directorate
________________________________
From: [email protected] [[email protected]] on
behalf of Doug [[email protected]]
Sent: Monday, July 18, 2011 1:34 AM
To: [email protected]
Subject: EXT :[sqlite] Handle leak using IIS on windows 7?
Hi there,
I've searched around and found a few threads like this:
http://sqlite.phxsoftware.com/forums/t/2480.aspx
Basically, I have the same issue.
When access the sqlite database via a website (MVC3 running on IIS) the
first time, sqlite works fine.
I properly call connections.Close() when I'm done...
And the next time I try to access it I get:
System.InvalidOperationException: No connection associated with this command
Manually stopping the dev web server, or restarting the iis application pool
fixes this for one more page view.
It seems like the IIS config is leaving the process hanging around, and
after calling close there (I guess) must be some handle which is being kept
and keeping a reference to the database, preventing anything else from
accessing it.
Seeing as how this has happened to a few people, I was hoping someone here
had seen this before and had a solution?
I'm using the Precompiled Binaries for 32-bit Windows (.NET Framework 4.0)
from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki(32
bit mode enabled on iis), but I've tried the 64-bit version with the
same result.
Cheers,
Doug.
_______________________________________________
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