I am trying to update two tables in Oracle database.The first try/catch part works fine, however, the second one does not update penalty_fine column, although I have used the same code. The query works fine on Toad. I tried to merge them into one try/catch by merging sql queries, but it did not work on the second table.
Any help is appreciated.
Thanks
try
{
OracleCommand command2 = new OracleCommand();
command2.CommandText = "Update t_payment set amount = :amount + (select amount from t_payment where penalty_order_id = (select id from t_penalty_order where protokol_no = :invoiceNumber)) where penalty_order_id = (select id from t_penalty_order where protokol_no = :invoiceNumber)";
command2.Parameters.Add(new OracleParameter(@"amount", OracleDbType.Int32)).Value = Convert.ToInt32(request.amount);
command2.Parameters.Add(new OracleParameter(@"invoiceNumber", OracleDbType.Varchar2, 255)).Value = request.invoiceNumber;
command2.Connection = connection;
command2.CommandType = System.Data.CommandType.Text;
command2.ExecuteNonQuery();
}
catch (Exception e)
{
completePayment.code = 111;
completePayment.message = e.Message;
completePayment.transactionNumber = null;
}
try
{
OracleCommand command2 = new OracleCommand();
command2.CommandText = "Update t_penalty_order set penalty_fine = 10 where protokol_no = :invoiceNumber";
command2.Parameters.Add(new OracleParameter(@"invoiceNumber", OracleDbType.Varchar2, 255)).Value = request.invoiceNumber;
command2.Connection = connection;
command2.CommandType = System.Data.CommandType.Text;
command2.ExecuteNonQuery();
}
catch (Exception e)
{
completePayment.code = 111;
completePayment.message = e.Message;
completePayment.transactionNumber = null;
}
I restarted the remote server and it started working. Thank you
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.