Problems with update Windows 8.1

Oct 24, 2013 at 1:55 PM
Edited Oct 24, 2013 at 1:56 PM
Hello,

First time here. I'm running into a problem which I had already exhausted my google-fu trying to solve. It concerns an exception in windows 8.1 when trying to update a table. I'm using the following code (almost identical to this article ) but I've no clue what's going wrong.

First things first, the table was created with the (almost) following SQL:
CREATE TABLE IF NOT EXISTS Ids(Id_str TEXT PRIMARY KEY, Ok INT DEFAULT 1)
I'm trying to update it with the following query:
"UPDATE Ids set Ok=0 where Id_str in (" + parameters + ")";
By using the following code:
Database db = await sqlite.getOpenedDatabase();
using (var stmt = await db.PrepareStatementAsync(sql))
{
   for (int i = 0; i < data.Count; i++)
   {
      stmt.BindTextParameterAt(i + 1, data[i]);
      Debug.WriteLine("Parameter " + data[i] + " bound at " + (i+1) ) ;
    }
    try
    {
       await stmt.StepAsync();           
     }
     catch (COMException ex)
     {
         SqliteReturnCode result = Database.GetSqliteErrorCode(ex.HResult);
         Debug.WriteLine("Exception: " + description + " failed with error " + ex.ToString());
         throw new Exception(description + " failed with error " + result);
      }
      catch (Exception ex)
      {
         SqliteReturnCode result = Database.GetSqliteErrorCode(ex.HResult);
         Debug.WriteLine("Exception: " + description + " failed with error " + ex.ToString());
         throw new Exception(description + " failed with error " + result);
       }
       finally
       {
          sqlite.dispose();
          Debug.WriteLine("SQLite disposed");
        }
 }
The sqlite class is just a bridge for the Database. And Exception captured is:
A first chance exception of type 'System.Exception' occurred in mscorlib.dll
Exception: Update failed with error System.Exception: Need to run the object to perform this operation (Exception from HRESULT: 0x80040005 (OLE_E_NOTRUNNING))
I'm in a x64 environment, running everything in debug mode for x64 in Visual Studio Express 2013 for Windows 8. Everything else works great, but updates.

By the way, I apologize in advance for any obvious mistakes since I'm programming in C# less than one week.

Thanks in advance and keep up the good work