From 2b231c1702e15ebb5be02c81074eba28305394fb Mon Sep 17 00:00:00 2001
From: cnf <3283105747@qq.com>
Date: 星期四, 13 十一月 2025 19:29:46 +0800
Subject: [PATCH] 委外工单合并领料完成
---
util/DbHelperSQL.cs | 34 ++++++++++++++++++++--------------
1 files changed, 20 insertions(+), 14 deletions(-)
diff --git a/util/DbHelperSQL.cs b/util/DbHelperSQL.cs
index 468dd88..4778134 100644
--- a/util/DbHelperSQL.cs
+++ b/util/DbHelperSQL.cs
@@ -2,7 +2,7 @@
using System.Data;
using System.Data.SqlClient;
-namespace Gs.Toolbox;
+namespace NewPdaSqlServer.util;
/// <summary>
/// 鏁版嵁璁块棶绫�
@@ -12,6 +12,24 @@
//鏁版嵁搴撹繛鎺ュ瓧绗︿覆(web.config鏉ラ厤缃�)
public static readonly string strConn =
getValueByKey("DataBaseConn");
+
+
+ public static string getValueByKey(string key)
+ {
+ // 鍒涘缓閰嶇疆鏋勫缓鍣�
+ var builder = new ConfigurationBuilder()
+ .SetBasePath(Directory.GetCurrentDirectory())
+ .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
+ .AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true);
+ // 鏋勫缓閰嶇疆
+ var configuration = builder.Build();
+ // 淇閰嶇疆璺緞锛氬鏋滄槸DataBaseConn锛岄渶瑕佷粠AppSettings鑺傜偣璇诲彇
+ if (key == "DataBaseConn")
+ {
+ return configuration["AppSettings:DataBaseConn"];
+ }
+ return configuration[key];
+ }
#region 鍏敤鏂规硶
@@ -571,6 +589,7 @@
else
str = str + "|" + command.Parameters[a].Value;
}
+
return str;
}
@@ -672,17 +691,4 @@
}
#endregion
-
-
- public static string getValueByKey(string key)
- {
- // 鍒涘缓閰嶇疆鏋勫缓鍣�
- var builder = new ConfigurationBuilder()
- .SetBasePath(Directory.GetCurrentDirectory())
- .AddJsonFile("appsettings.json", true, true);
- // 鏋勫缓閰嶇疆
- var configuration = builder.Build();
- return configuration[key];
- }
-
}
\ No newline at end of file
--
Gitblit v1.9.3