in

System.Data.SQLite

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

1.0.63 - CVS Build (Win32) - InvalidOperationException("Database is not open");

Last post 07-05-2009 11:25 AM by Robert Simpson. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-05-2009 5:35 AM

    • Gareth
    • Top 500 Contributor
    • Joined on 07-02-2009
    • Posts 4

    1.0.63 - CVS Build (Win32) - InvalidOperationException("Database is not open");

     When getting the latest code from CVS I successfully build the Win32 version, but when ever a PRAGMA function is called it appears to determine if the DB is open and then throw this error. Unfortunately this is getting triggered from the SQLiteConnection.Open call, which then fails as we havn't officially opened the DB yet :-(.

               defValue = FindKey(opts, "Legacy Format", Boolean.FalseString);
              cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA legacy_file_format={0}", SQLiteConvert.ToBoolean(defValue) == true ? "ON" : "OFF");
              cmd.ExecuteNonQuery();

              defValue = FindKey(opts, "Synchronous", "Normal");
              if (String.Compare(defValue, "Full", StringComparison.OrdinalIgnoreCase) != 0)
              {
                cmd.CommandText = String.Format(CultureInfo.InvariantCulture, "PRAGMA synchronous={0}", defValue);
                cmd.ExecuteNonQuery();
              }

    The default connection string causes the other tests to skip the attempts to ExecuteNonQuery, but both "Legacy Format" and "Synchronous" cause it to step throughSQLiteCommand:ExecuteNonQuery, SQLiteCommand:ExecuteReader, SQLiteCommand:InitializeForReader.

    Any guidance would be appreciated,

    Many thanks again,

    Gareth

  • 07-05-2009 11:25 AM In reply to

    Re: 1.0.63 - CVS Build (Win32) - InvalidOperationException("Database is not open");

    Yea I don't recommend building off CVS ... things are experimental there at any given moment and I check things in infrequently.  That bug you've encountered was just a temporary glitch after the 63 release where I was experimenting.

     

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