Example #1
0
        private void sbtn_OK_Click(object sender, EventArgs e)
        {
            switch (this.cbe_Type.Text)
            {
            case "File":
                this.connInfo.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
                this.connInfo.Database       = this.te_DSName.Text;
                this.connInfo.Password       = this.te_Pwd.Text;
                break;

            case "MySql":
                this.connInfo.ConnectionType = gviConnectionType.gviConnectionMySql5x;
                this.connInfo.Server         = this.te_ServerOrPath.Text;
                this.connInfo.Port           = (uint)this.te_PortNo.Value;
                this.connInfo.UserName       = this.te_Username.Text;
                this.connInfo.Password       = this.te_Pwd.Text;
                this.connInfo.Database       = this.cbe_DSName.Text;
                break;

            case "Oracle":
                this.connInfo.ConnectionType = gviConnectionType.gviConnectionOCI11;
                this.connInfo.Instance       = this.te_Instance.Text;
                this.connInfo.Server         = this.te_ServerOrPath.Text;
                this.connInfo.Port           = (uint)this.te_PortNo.Value;
                this.connInfo.UserName       = this.te_Username.Text;
                this.connInfo.Password       = this.te_Pwd.Text;
                this.connInfo.Database       = this.cbe_DSName.Text;
                break;

            case "Microsoft SQLServer":
                this.connInfo.ConnectionType = gviConnectionType.gviConnectionMSClient;
                this.connInfo.Instance       = this.te_Instance.Text;
                this.connInfo.Server         = this.te_ServerOrPath.Text;
                this.connInfo.Port           = (uint)this.te_PortNo.Value;
                this.connInfo.UserName       = this.te_Username.Text;
                this.connInfo.Password       = this.te_Pwd.Text;
                this.connInfo.Database       = this.cbe_DSName.Text;
                break;

            case "Citymaker Service":
                this.connInfo.ConnectionType = gviConnectionType.gviConnectionCms7Http;
                this.connInfo.Server         = this.te_ServerOrPath.Text;
                this.connInfo.Port           = (uint)this.te_PortNo.Value;
                this.connInfo.UserName       = this.te_Username.Text;
                this.connInfo.Password       = this.te_Pwd.Text;
                this.connInfo.Database       = this.te_DSName.Text;
                break;
            }
            if (!DataUtils.CanConnection(this.connInfo))
            {
                XtraMessageBox.Show("打开数据失败,请检查网络或连接参数!", "提示");
                return;
            }
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }