Beispiel #1
0
        private void 数据库配置ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            _sysCfg = new SysConfigManager().Get();
            var form = new DbConfig();
            form.InitConfig(_sysCfg.DbConfig);
            var result = form.ShowDialog();

            if (result != DialogResult.OK) return;

            form.SetConfig(_sysCfg.DbConfig);
            var sh = new SqlHelper(_sysCfg.DbConfig.GetConnectionString());
            try
            {
                sh.Open();
                new SysConfigManager().Set(_sysCfg);
                try
                {
                    sh.Execute(_sysCfg.Excel2TplusHistorySql);
                }
                catch { }
            }
            catch
            {
                MessageBox.Show("数据库无法连接");
            }
            finally
            {
                sh.Close();
            }
        }
Beispiel #2
0
 private void 安装历史记录表ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var sysCfg = new SysConfigManager().Get();
     if (!sysCfg.HasDbConfig)
     {
         MessageBox.Show("请先设置数据库信息");
         return;
     }
     if (MessageBox.Show("安装历史记录表将删除之前的历史记录,确定删除吗?", "注意", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         var sqlHelper = new SqlHelper(sysCfg.DbConfig.GetConnectionString());
         sqlHelper.Open();
         sqlHelper.Execute(sysCfg.Excel2TplusHistorySql);
         sqlHelper.Close();
         MessageBox.Show("安装成功");
     }
 }