示例#1
0
        /// <summary>
        /// 连接名选择中
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Link_Selected(object sender, RoutedEventArgs e)
        {
            var boxItem = dbTypeLink.SelectedItem as DataLink;

            if (boxItem != null)
            {
                AppCache.SetBuildLink(boxItem);
                InitLinkInfo();
            }
        }
示例#2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            dbConn = Common.GetConnStr(dbType, txtUserName, txtPwd, txtHostName, txtPort, txtServerName);

            if (!DataSchema.CheckLink(dbType, dbConn))
            {
                CodeBox.Show("连接数据库失败!", this);
            }
            else
            {
                var buildLink = Common.ControlsToData(dbType, txtHostName, txtUserName, txtPwd, txtPort, txtServerName, labServerName, true, txtLinkName);
                buildLink.connStr = dbConn;
                Common.SaveConfigLink(buildLink);
                AppCache.SetBuildLink(buildLink);
                this.Owner.Title = string.Format("数据工具-{0}", txtLinkName.Text);
                AppCache.SetTitle(this.Owner.Title);
                AppCache.SetOnLine(buildLink);
                this.Close();
            }
        }