Has anyone gotten the SqliteConnection CreateCommand() to actually work? Here's my simple code with some parameters that is always returning a "0". And the update does not save to the database. No error is returned.
try { int update = 0; string msg = ""; string qry = "UPDATE [TextAreas] SET [Comments] = ? WHERE [SiteID] = ? AND [TextID] = ?"; var cmd = database.CreateCommand(qry, myComments, mySiteID, myTextID); update = cmd.ExecuteNonQuery(); //update = database.Execute(qry, myComments, mySiteID, myTextID); //database.Update(txtArea); // always throws a No PK error even after table has a PK. if(update == 0) { throw new Exception("TextAreas table was not updated."); } } catch (Exception ex) { msg = "Error Updating TextAreas: " + ex.Message; }
Posts
Got it fixed now. Apparently you can have the .db file opened in a program like DB Browser while trying to call ExecuteNonQuery functions.