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();