Exemplo n.º 1
0
        /// <summary>
        /// 根据连接信息获取工作空间
        /// </summary>
        /// <param name="clsConninfo">用于提供连接信息的类</param>
        /// <returns>工作空间</returns>
        public IWorkspace GetWorkspace(ClsConnectInfo clsConninfo)
        {
            IWorkspaceFactory pWorkSpaceFactory = null;
            IPropertySet      pPropertySet      = null;

            pPropertySet      = new PropertySet();
            pWorkSpaceFactory = new SdeWorkspaceFactory();

            //根据连接信息的对应信息设置属性集
            pPropertySet.SetProperty("Server", clsConninfo.Server);
            pPropertySet.SetProperty("Instance", clsConninfo.Service);
            pPropertySet.SetProperty("User", clsConninfo.User);
            pPropertySet.SetProperty("Password", clsConninfo.Password);
            pPropertySet.SetProperty("Version", clsConninfo.Version);

            //返回打开的工作空间
            return(pWorkSpaceFactory.Open(pPropertySet, 0));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 得到上次的SDE连接设置
        /// </summary>
        private void GetPropSetting()
        {
            ////得到上次的SDE连接设置
            this.txtSet1.Text = Interaction.GetSetting(Application.CompanyName, "SDESeting", "Server", "");
            this.txtSet2.Text = Interaction.GetSetting(Application.CompanyName, "SDESeting", "Instance", "");
            this.txtSet3.Text = Interaction.GetSetting(Application.CompanyName, "SDESeting", "Database", "");
            this.txtSet4.Text = Interaction.GetSetting(Application.CompanyName, "SDESeting", "user", "");
            this.txtSet5.Text = Interaction.GetSetting(Application.CompanyName, "SDESeting", "password", "");
            //if (txtSet1.Text == "" && txtSet2.Text == "" && txtSet3.Text == "" && txtSet4.Text == "")
            if (txtSet1.Text == "" || txtSet2.Text == "" || txtSet3.Text == "" || txtSet4.Text == "" || txtSet5.Text == "")
            {
                ClsConnectInfo connectInfo = new ClsConnectInfo();
                connectInfo.GetInfoFromXml();
                txtSet1.Text = connectInfo.Server;
                txtSet2.Text = connectInfo.Service;

                txtSet3.Text = connectInfo.Database;

                txtSet4.Text     = connectInfo.User;
                txtSet5.Text     = connectInfo.Password;
                comboBoxEx1.Text = connectInfo.Version;
                comboBoxEx2.Text = connectInfo.Authenication_mode;
            }
        }
Exemplo n.º 3
0
 public ClsDBInfo(ClsConnectInfo info)
 {
     connInfo = info;
 }