From 0aa54059b26e6641196e9953490dd18616e916e3 Mon Sep 17 00:00:00 2001 From: 啊鑫 <t2856754968@163.com> Date: 星期三, 10 九月 2025 17:26:47 +0800 Subject: [PATCH] 精简修正代码 --- util/DbHelperSQL.cs | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/util/DbHelperSQL.cs b/util/DbHelperSQL.cs index 468dd88..d950ee8 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,18 @@ //鏁版嵁搴撹繛鎺ュ瓧绗︿覆(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", true, true); + // 鏋勫缓閰嶇疆 + var configuration = builder.Build(); + return configuration[key]; + } #region 鍏敤鏂规硶 @@ -571,6 +583,7 @@ else str = str + "|" + command.Parameters[a].Value; } + return str; } @@ -672,17 +685,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