コード例 #1
0
        private void btnTestConnect_Click(object sender, EventArgs e)
        {
            string             dbip   = this.txtDBIp.Text;
            string             dbport = this.txtDBPort.Text;
            string             dbname = this.txtDBName.Text;
            string             dbsa   = this.txtDBSa.Text;
            string             dbpwd  = this.txtDBPwd.Text;
            FeedbackInfomation fi     = new FeedbackInfomation();

            fi = DataValidate.ValidateIpAddress(dbip);
            if (fi.ErrorStatus != STATUS_ADAPTER.IP_NORMAL)
            {
                MsgBox.ShowDialog(Tips.DB + fi.FeedbackMessage);
                return;
            }
            DBTestBLL dtbll = new DBTestBLL();

            fi = dtbll.TestDBConnect(dbip, dbport, dbname, dbsa, dbpwd);
            if (fi.ErrorStatus == STATUS_ADAPTER.DB_CONNECT_NORMAL)
            {
                this.labDBStatus.Text = "状态:" + this.STATUS_DBTEST_CONNECTED;
                SetDbStatus();
                //MsgBox.ShowDialog(Tips.DB_CONNECTTEST_SUCCESS);
            }
            else
            {
                this.labDBStatus.Text = this.STATUS_DBTEST_NOCONNECTED;
                MsgBox.ShowDialog(Tips.DB_CONNECTTEST_FAILED);
            }
        }