我正在尝试更新Oracle database.The中的两个表first try/catch部分工作正常,但是,第二个表不更新penalty_fine列,尽管我使用了相同的代码。查询在Toad上运行正常。我试图通过合并sql查询将它们合并到一个try/catch中,但在第二个表上不起作用。
任何帮助都是非常感谢的。
谢谢
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;
}
转载请注明出处:http://www.sthongjia.com/article/20230526/1570181.html