private void btnImport_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show(string.Format("请选择要导入的数据库"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow datarow = dataGridView1.SelectedRows[0]; string name = (datarow.Cells["name"].Value == null ? "" : datarow.Cells["name"].Value.ToString()); string des = (datarow.Cells["des"].Value == null ? "" : datarow.Cells["des"].Value.ToString()); string type = (datarow.Cells["type"].Value == null ? "CPRS" : datarow.Cells["type"].Value.ToString()); int id = Convert.ToInt32(datarow.Cells["Id"].Value.ToString()); if (MDIMain.Ztid != id && MDIMain.Ztid != 0) { if (MessageBox.Show(string.Format("您正在使用专题库:【{0}】,{1}是:关闭现有专题库,打开新专题库【{2}】{1}否:继续使用当前专题库:【{0}】", MDIMain.Ztname, Environment.NewLine, name), "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { //关闭所有页面 foreach (Form form in ((MDIMain)this.Parent.Parent).MdiChildren) { if (form is ZTListNew) { continue; } else { form.Close(); } } //切换专题库 MDIMain.Ztid = id; MDIMain.Ztname = name; MDIMain.Dbtype = type; ((MDIMain)this.MdiParent).tssZTName.Text = "当前选择专题库:" + MDIMain.Ztname; } } else { MDIMain.Ztid = id; MDIMain.Ztname = name; MDIMain.Dbtype = type; ((MDIMain)this.MdiParent).tssZTName.Text = "当前选择专题库:" + MDIMain.Ztname; } DBIN frmdbin = new DBIN(MDIMain.Ztname, MDIMain.Ztid, MDIMain.Dbtype); frmdbin.MdiParent = this.MdiParent; frmdbin.Show(); this.Close(); }
private void btnImport_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show(string.Format("请选择要导入的数据库"), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataGridViewRow datarow = dataGridView1.SelectedRows[0]; string name = (datarow.Cells["name"].Value == null ? "" : datarow.Cells["name"].Value.ToString()); string des = (datarow.Cells["des"].Value == null ? "" : datarow.Cells["des"].Value.ToString()); string type = (datarow.Cells["type"].Value == null ? "CPRS" : datarow.Cells["type"].Value.ToString()); int id = Convert.ToInt32(datarow.Cells["id"].Value.ToString()); DBIN frmdbin = new DBIN(name, id, type); frmdbin.MdiParent = this.MdiParent; frmdbin.Show(); }
private void 导入数据AToolStripMenuItem_Click(object sender, EventArgs e) { foreach (Form form in this.MdiChildren) { if (form is DBIN) { form.Show(); return; } } DBIN dbin; if (MDIMain.Ztname != null) { dbin = new DBIN(MDIMain.Ztname, MDIMain.Ztid, MDIMain.Dbtype); dbin.Show(); } else { MessageBox.Show("请先选择专题库", "提示"); } }