From 5b840d0c669d3837aa02351b0da7916e8b33303e Mon Sep 17 00:00:00 2001 From: "Robin_PC\\robin" <3504557@qq.com> Date: Wed, 24 Sep 2025 12:11:31 +0800 Subject: [PATCH] . --- FireBirdUtil/SqlHelper/SqlHelper.cs | 6 ++++++ WeighBusiness/BL/ProductCatalogBL.cs | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/FireBirdUtil/SqlHelper/SqlHelper.cs b/FireBirdUtil/SqlHelper/SqlHelper.cs index 2e13a2b..9b329c6 100644 --- a/FireBirdUtil/SqlHelper/SqlHelper.cs +++ b/FireBirdUtil/SqlHelper/SqlHelper.cs @@ -100,6 +100,12 @@ namespace FireBirdUtil.SqlHelpers string errorMessage; ExecuteNonQuery(sql, out success, out errorMessage); } + public string ExecuteNonQuery2(string sql, out bool success) + { + string errorMessage; + ExecuteNonQuery(sql, out success, out errorMessage); + return errorMessage; + } public void ExecuteNonQuery(string sql, out bool success, out string errorMessage) { diff --git a/WeighBusiness/BL/ProductCatalogBL.cs b/WeighBusiness/BL/ProductCatalogBL.cs index b966923..108171e 100644 --- a/WeighBusiness/BL/ProductCatalogBL.cs +++ b/WeighBusiness/BL/ProductCatalogBL.cs @@ -299,10 +299,14 @@ namespace WeighBusiness.BL { string insertSql = InsertUtil.GetInsertSql(TableNames.客户端产品分类, new string[] { "ProductCatalog_ID", "Name", "Sequence", "RowVersion" }, - new string[] { catalog.ProductCatalog_ID.ToString(), catalog.ProductCatalog_ID.ToString(), catalog.Sequence.ToString(),"0" }); - she.ExecuteNonQuery(insertSql, out success); - if (!success) - she.Rollback(); + new string[] { catalog.ProductCatalog_ID.ToString(), catalog.ProductCatalog_ID.ToString(), catalog.Sequence == null ? "null" : catalog.Sequence.ToString(), "0" }); + she.ExecuteNonQuery(insertSql, out success, out errorMessage); + if (!success) + { + throw new ApplicationException(errorMessage); + //she.Rollback(); + } + } } she.Commit();