private void 添加学籍信息ToolStripMenuItem_Click(object sender, EventArgs e) { this.Visible = true; // m_connection.Close(); 添加学生学籍窗口 ScanForm = new 添加学生学籍窗口(); DialogResult re = ScanForm.ShowDialog(); }
/// <summary> /// 点击添加按钮,打开添加学生学籍窗口 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Add_button_Click(object sender, EventArgs e) { FormAddN = new 添加学生学籍窗口(); DialogResult re = FormAddN.ShowDialog(); //如果添加了学籍信息,更新浏览学籍信息界面 if (DialogResult.OK == re) { SqlDataAdapter da = new SqlDataAdapter(stuText, m_connection); DataSet ds = new DataSet("s"); //创建dataset对象,调用指定数据集名称的构造函数 da.Fill(ds, "stable"); //使用SqlDataAdapter对象的fill方法填充数据集,填充到“stable“表 //dataGridView1.AutoGenerateColums = ture; //dataGridview控件绑定数据源 dataGridView1.DataSource = ds; dataGridView1.DataMember = "stable"; } }