in

System.Data.SQLite

An open-source, enhanced version of the SQLite database engine for Windows

Urgently! SQLiteException "Library routine called out of sequence"

Last post 04-14-2008 2:22 AM by Malik Amurlayev. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 04-14-2008 2:11 AM

    Urgently! SQLiteException "Library routine called out of sequence"

    I've read all the posts concerning this exception and all of them telling that the problem is in shared use of connection between diferent threads.... In my case this is a single thread application, i'm using no timers, no backgroundwarkers, no extra threads at all, everything happens in main thread... i just want to fetch all records where some condition is true, but get the exception at ExecuteReader.

    Here is the call stack: 

    System.Data.SQLite.SQLiteException was unhandled
      Message="Library used incorrectly\r\nlibrary routine called out of sequence"
      StackTrace:
        bij System.Data.SQLite.SQLite3.Bind_Int64(SQLiteStatement stmt, Int32 index, Int64 value)
        bij System.Data.SQLite.SQLiteStatement.BindParameter(Int32 index, SQLiteParameter param)
        bij System.Data.SQLite.SQLiteStatement.BindParameters()
        bij System.Data.SQLite.SQLiteCommand.GetStatement(Int32 index)
        bij System.Data.SQLite.SQLiteDataReader.NextResult()
        bij System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, CommandBehavior behave)
        bij System.Data.SQLite.SQLiteCommand.ExecuteReader(CommandBehavior behavior)
        bij System.Data.SQLite.SQLiteCommand.ExecuteReader()
        bij Postron.Model.LookupItemAdapter.Fetch(Int64 lookupId)
        bij MyTouch.MyTouchManager.BeginLookupItemReader(Int64 lookupId)
        bij MyTouch.LookupScreen.OnPopulate()
        bij Postron.UI.FormEnhanced.Populate()
        bij MyTouch.LookupScreen.ShowLookup(Int64 lookupId, Int32 quantity)
        bij MyTouch.ProductGrid.GridButtonClick(Object sender, EventArgs e)
        bij System.Windows.Forms.Control.OnClick(EventArgs e)
        bij System.Windows.Forms.Control.WnProc(WM wm, Int32 wParam, Int32 lParam)
        bij System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)
        bij Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)
        bij System.Windows.Forms.Application.Run(Form fm)
        bij MyTouch.Program.Main(String[ args)

     

    Here is the code where the exception raises: 

            public SQLiteDataReader Fetch(long lookupId)
            {
                this.fetchByLookupCmd.Parameters[0].Value = lookupId;
                return this.fetchByLookupCmd.ExecuteReader();
            }

    SQLiteCommand is initialized in ctor:

    this.fetchByLookupCmd = new SQLiteCommand("SELECT * FROM LookupItem WHERE LookupID = @LookupID", this.Connection);
    this.fetchByLookupCmd.Parameters.Add(new SQLiteParameter("@LookupID", DbType.Int64, "LookupID")); 

     

    Thanks in advance for helping me solving this issue!

  • 04-14-2008 2:22 AM In reply to

    Re: Urgently! SQLiteException "Library routine called out of sequence"

    Answer

     I'm very sorry! The problem is solved! Stupid error, I've forgot to close the reader and at the next call of this method i've got this exception. So it was the issue of "currently running statement"....

      

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