CRUD in C # is not releasing integrity violation error while deleting dependent registry in SQLite DB.
query = "DELETE FROM "+ table +
" WHERE id = '" + id + "';";
int returnValue = 0;
try
{
conn = new SQLiteConnection(connStr);
conn.Open();
cmd = conn.CreateCommand();
cmd.CommandText = query;
returnValue = cmd.ExecuteNonQuery();
conn.Close();
}
catch (Exception e)
{
MessageBox.Show("O seguinte erro está impedindo o correto " +
"funcionamento do aplicativo: \r\n" + e.Message);
}
When I delete a client that has dependent records, no error is thrown. In SQLite Studio you can see that the Client has been deleted but the dependent record still has the inherited client key. Another note is that the return value of ExecuteNonQuery () is always 1.