/// <summary> /// 执行存储过程 /// </summary> /// <param name="ReferSql">调用存储过程语句</param> /// <return>DataTable</return> //--------------------------------------------------------------------------------------- // 1.ID : Gp_MsgBoxDisplay // 2.Input Value : sMsg String, {sIcon String}, {sTitle String} // 3.Return Value : // 4.Create Date : // 5.Modify Date : // 6.Comment : Message Box Only Display //--------------------------------------------------------------------------------------- public static DataTable Gf_ExecProc2Ref(string ReferSql) { DataTable DataTab_temp = new DataTable(); if (GeneralCommon.OleDbConn.State == 0) { if (GeneralCommon.GF_DbConnect() == false) { return(DataTab_temp); } } try { GeneralCommon.Gp_LogData(ReferSql); OleDbDataAdapter OleDA = new OleDbDataAdapter(ReferSql, OleDbConn); OleDA.Fill(DataTab_temp); return(DataTab_temp); } catch (Exception ex) { Gp_MsgBoxDisplay("Gf_ExecProc2Ref Error : " + ex.Message); return(DataTab_temp); } finally { if (GeneralCommon.OleDbConn.State != 0) { GeneralCommon.OleDbConn.Close(); } } }
private void Timer_Conut_Tick(object sender, EventArgs e) { Timer_Conut.Stop(); if (GeneralCommon.GF_DbConnect() == true) { ExeMain(); } else { GeneralCommon.Gp_MsgBoxDisplay("网络连接异常,进入检测程序", "W", "DataBase Connection"); Chk_Net(); this.Dispose(); } }
/// <summary> /// 日志记录 /// </summary> /// <param name="sLOG_INFO">信息</param> /// <param name="sLOG_MSG">日志信息</param> /// <param name="sLOG_data">信息内容</param> /// <param name="sLOG_TYPE">信息类型</param> /// <param name="sINS_EMP">插入人</param> /// <return>bool</return> public static bool Gp_Log(string sLOG_INFO, string sLOG_MSG, string sLOG_data, string sLOG_TYPE, string sINS_EMP) { bool functionReturnValue = false; //Db Connection Check if (GeneralCommon.OleDbConn_Log.State == 0) { if (GeneralCommon.GF_DbConnect() == false) { return(false); } } // OleDbTransaction OleTra; // OleTra = OleDbConn.BeginTransaction(); try { Cursor.Current = Cursors.WaitCursor; OleDbCommand OleDC = new OleDbCommand("PKG_Z_LOG.SET_LOG", OleDbConn_Log); OleDC.CommandType = CommandType.StoredProcedure; OleDC.Parameters.Add(new OleDbParameter("sLOG_INFO", string.IsNullOrEmpty(sLOG_INFO) ? "" : sLOG_INFO)); //.Replace("'", "''"))); OleDC.Parameters.Add(new OleDbParameter("sLOG_MSG", string.IsNullOrEmpty(sLOG_MSG) ? "" : sLOG_MSG)); //.Replace("'", "''"))); OleDC.Parameters.Add(new OleDbParameter("sLOG_data", string.IsNullOrEmpty(sLOG_data) ? "" : sLOG_data)); //.Replace("'", "''") )); OleDC.Parameters.Add(new OleDbParameter("sLOG_TYPE", string.IsNullOrEmpty(sLOG_TYPE) ? "" : sLOG_TYPE)); OleDC.Parameters.Add(new OleDbParameter("sINS_EMP", string.IsNullOrEmpty(sINS_EMP) ? string.IsNullOrEmpty(GeneralCommon.sUserID) ? "SYSTEM" : GeneralCommon.sUserID : sINS_EMP)); OleDC.Parameters.Add(new OleDbParameter("sIP", Gf_GetIP())); //Ceate Input Parameter //for (int iCount = 0; iCount < 5; iCount++) //{ // OleDC.Parameters.Add(sLOG_INFO);//new OleDbParameter("", OleDbType.Variant)); // OleDC.Parameters[iCount].Value = Para_Info[iCount]; // // OleDC.Parameters[iCount].Size = 2000; // // OleDC.Parameters.Add(Para_Info[iCount]); //} // OleDC.Parameters.Add("e_code", OleDbType.Integer).Direction = ParameterDirection.Output; // OleDC.Parameters.Add("e_msg", OleDbType.Variant).Direction = ParameterDirection.Output; // OleDC.Transaction = OleTra; OleDC.ExecuteNonQuery(); //Process Error Check //if (OleDC.Parameters["e_code"].Value.ToString() != "0") //{ // OleTra.Rollback(); // sErrMessg = "Gf_ExecProc2Modify Error Code : " + Proce_Name + " " + OleDC.Parameters["e_code"].Value.ToString() + "\r" + "Error Mesg : " + OleDC.Parameters["e_msg"].Value.ToString(); // Gp_MsgBoxDisplay(sErrMessg); // functionReturnValue = false; //} //else //{ // OleTra.Commit(); // functionReturnValue = true; //} //Cursor.Current = Cursors.Default; } catch (Exception ex) { // OleTra.Rollback(); functionReturnValue = false; Cursor.Current = Cursors.Default; Gp_MsgBoxDisplay("日志记录错误 : " + sLOG_data + " " + ex.Message); } //finally return(functionReturnValue); }