I've got a little problem when trying to delete a row from a sqlite database.
I set the database up like this:
CREATE TABLE IF NOT EXISTS patient ( patient_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, vorname VARCHAR(100) NOT NULL,nachname VARCHAR(100) NOT NULL,adresse VARCHAR(100) NOT NULL,ort VARCHAR(100) NOT NULL,plz INTEGER NOT NULL,geburtstag DATE NOT NULL);
There is definitely data in there and I tried to delete a row like this:
public void deletePatientById(long id)
{
string deleteQuery = "DELETE FROM patient WHERE patient_id="+id.ToString()+";";
SQLiteCommand command = new SQLiteCommand(deleteQuery, connection);
command.ExecuteNonQuery();
command.Dispose();
MessageBox.Show("Patient: " + id.ToString() + " gelöscht");
}
The problem is, VS tells me, there is no such Column named patient_id. But actually there is as far as i can see.
Anyone an idea what might be wrong here?