private void Ok_btn_Click(object sender, EventArgs e) { Exception eError = null; this._ID = this.ID_tex.Text; this._IP = this.IP_tex.Text; this._Password = this.Password_tex.Text; if (this.IP_tex.Text == "" || this.ID_tex.Text == "" || this.Password_tex.Text == "" || txtDB.Text == "") { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", "连接信息填写不完整!"); return; } ModDBOperator.ConnectDB(txtDB.Text.Trim(), this.IP_tex.Text, this.ID_tex.Text, this.Password_tex.Text, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", eError.Message); } this.Close(); }
public override void OnClick() { Exception eError = null; DevComponents.AdvTree.Node SelNode = m_Hook.ProjectTree.SelectedNode; if (SelNode.DataKey.ToString() == EnumTreeNodeType.DATACONNECT.ToString()) { //建立连接 if (SelNode.Name == "FileDBConnNode") { //文件连接 frmConSet frmconset = new frmConSet(); frmconset.ShowDialog(); } else if (SelNode.Name == "SpatialDBConnNode") { //空间连接 } } else if (SelNode.DataKey.ToString() == EnumTreeNodeType.DATABASE.ToString()) { //读取xml连接参数,连接库体 Exception ex = null; string ConType = SelNode.Name; if ("文件连接" == ConType) { //文件库连接 XmlElement Ele = SelNode.Tag as XmlElement; if (null == Ele) { return; } string ip = Ele.GetAttribute("服务器"); string id = Ele.GetAttribute("用户"); string password = Ele.GetAttribute("密码"); string dbConnStr = Ele.GetAttribute("MetaDBConn"); ModDBOperator.ConnectDB(dbConnStr, ip, id, password, out eError); if (eError != null) { SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", eError.Message); return; } /////////////////////加载底图(2010.5.31临时添加)///////////////////////// //SysCommon.Gis.SysGisDataSet pSysGis = new SysCommon.Gis.SysGisDataSet(); //pSysGis.SetWorkspace(dbConnStr, SysCommon.enumWSType.PDB, out ex); //if (ex != null) //{ // SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("错误", "连接范围图层失败!"); // return; //} //IFeatureLayer featurelayer = new FeatureLayerClass(); //IFeatureClass featureclass = pSysGis.GetFeatureClass("ProjectRange", out ex); //if (ex != null) //{ // SysCommon.Error.ErrorHandle.ShowFrmErrorHandle("提示", ex.Message); // return; //} //featurelayer.FeatureClass = featureclass; //ILayer layer = featurelayer as ILayer; //layer.Name = "项目范围图"; //ModData.v_AppFileDB.MapControl.Map.AddLayer(layer); ////////////////////////////////////////////// } if (ConType == "空间连接") { //空间连接 } } }