Exemplo n.º 1
0
        private static void OleDbHelper_ExecuteError(object sender, ExecuteErrorEventArgs e)
        {
            try
            {
                CommControl.Tools.WriteLog.AppendErrorLog(e.Sql + "\r\n" + e.Exception.Message + e.Exception.StackTrace);
                OleDbHelper ole = (OleDbHelper)sender;
                if (ole.ConnState == System.Data.ConnectionState.Closed && frmConnect==null)
                {
                    frmConnect = new Start.frmConnect();
                    frmConnect.ShowDialog();
                    frmConnect = null;
                    //CommControl.MessageBoxEx.MessageBoxEx.Show("执行数据库操作错误,请重试!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }  
            }
            catch
            {

            }
        }
Exemplo n.º 2
0
        static void OleDbHelper_StateChanged(object sender, System.Data.StateChangeEventArgs e)
        {
            try
            {

                if (e.CurrentState == System.Data.ConnectionState.Closed && frmConnect==null)
                {
                    frmConnect = new Start.frmConnect();
                    frmConnect.ShowDialog();
                    frmConnect = null;
                    //Timer tConnect = new Timer();
                    //tConnect.Tick+=new EventHandler(tConnect_Tick);
                    //tConnect.Interval = 5000;
                    //tConnect.Enabled = true;
                    //tConnect_Tick(tConnect,null);
                    //CommControl.MessageBoxEx.MessageBoxEx.Show("数据库断开连接或中断过连接,必须重启软件,请按确定后退出", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //Environment.Exit(0);  
                }
            }
            catch
            {
                //if (mes != "")
                CommControl.MessageBoxEx.MessageBoxEx.Show("数据库断开连接或中断过连接,必须重启软件,请按确定后退出", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Environment.Exit(0);
            }
        }