I have this helper function:
public bool Delete(String tableName, String where)
{
Boolean returnCode = true;
try
{
this.ExecuteNonQuery(String.Format("delete from {0} where {1};", tableName, where));
}
catch (Exception fail)
{
MessageBox.Show(fail.Message);
returnCode = false;
}
return returnCode;
}
TableName contains "[MyTable]" and where contains "[MyTable ID]='4ffbd580-b17d-4731-b162-ede8d698e026'" which is a unique guid representing the row ID.
The function returns true, like it was successful, and no exception, but the rows are not deleted from DB, what's wong?
This is the ExecuteNonQuery function
public int ExecuteNonQuery(string sql)
{
SQLiteConnection cnn = new SQLiteConnection(dbConnection);
cnn.Open();
SQLiteCommand mycommand = new SQLiteCommand(cnn);
mycommand.CommandText = sql;
int rowsUpdated = mycommand.ExecuteNonQuery();
cnn.Close();
return rowsUpdated;
}