I can delete the data from all 3 table except for transaction. I'm not sure why as i used the same codes to remove its data.
The error is:
An exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll but was not handled in user code
Additional information: Incorrect syntax near the keyword " transaction "
This is my code:
string sql4 = @"DELETE FROM medicine; DELETE FROM batch_number;DELETE FROM patient; DELETE FROM transaction;";
if (DBMgr.ExecuteSQL(sql4) >= 0)
{
LtlDatabaseMessage.Text = "Deletion successful";
}
else
{
LtlDatabaseMessage.Text = "Unexpected error";
}
Transaction is a keyword; you may need to escape it as in [transaction]
if SQL Server. The exact escaping changes between RDBMS. It would be "transaction"
on Oracle.
Transaction is a keyword. So it is not allowing. If you want to use Transaction as table name.Try this,
string sql4 = @"DELETE FROM [medicine]; DELETE FROM [batch_number];DELETE FROM patient; DELETE FROM [transaction];";
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.