【日 志】
?
/// <summary>/// 記錄執行sql時的錯誤日志/// <para>cmdTxt 執行的sql</para>/// <para>inputParams 傳入的Hashtable參數</para>/// </summary>private static void LogLastError(string cmdTxt, Hashtable inputParams){try{StringBuilder sb = new StringBuilder();sb.AppendLine("OperateRecord 操作數據庫發生錯誤 : \r\n====================插如sql或存儲過程名稱");sb.AppendFormat("{0}", cmdTxt).AppendLine();sb.AppendLine("====================參數如下");if (inputParams != null && inputParams.Count > 0)foreach (DictionaryEntry entry in inputParams)sb.AppendFormat("參數名稱:{0} 參數值:{1}", entry.Key, entry.Value).AppendLine();LogHelper.Instance.WriteError(sb.ToString());}catch (Exception ex){string path = string.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, "記錄執行sql時的錯誤日志 發生異常.txt");string text = string.Format("\r\n {0} {1} \r\n", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), ex.ToString());System.IO.File.AppendAllText(path, text);}}?
轉載于:https://www.cnblogs.com/kikyoqiang/p/10337402.html
總結
- 上一篇: 建设单位到哪里办理施工备案?备案时需提供
- 下一篇: GPU下train 模型出现nan