Why are you using such complicated code to delete a single record? If ALL you want to do is delete
patient number 11-11001, just issue a real DELETE command:
OleDbCommand Cmd = new OleDbCommand("DELETE FROM table1 WHERE
PatientNo='11-11001'", Conn);
Cmd.ExecuteNonQuery();
Of course, I'm sure you'll be passing the patient number in as a variable,
so I'd recommend you throw a parameter into the command and then fill it.
(And definitely use parameters, not the string concatenation you showed
above; that's just asking for SQL injection.) I don't know the parameter
syntax for OleDb or I'd have given a sample. (I think it's the question
mark.)
|