//增加 private void 增加ToolStripMenuItem_Click(object sender, EventArgs e) { SthInf st = new SthInf(); st.Show(); this.Hide();//隐藏本窗体 }
//修改 private void 修改ToolStripMenuItem_Click(object sender, EventArgs e) { ComVal.StuNA = dataGridView1.SelectedCells[0].Value.ToString(); //获取考生姓名 string sql = "select * from UserInfo where userName='******'"; OleDbConnection con = DataClass.DBCon(); con.Open(); OleDbCommand com = new OleDbCommand(sql, con); OleDbDataReader re = com.ExecuteReader(); if (re.Read()) { //传递选中考生数据 ComVal.StuSex = re[7].ToString(); ComVal.StuID = re[3].ToString(); ComVal.Iste = Convert.ToInt32(re[5].ToString()); ComVal.StuPw = re[4].ToString(); ComVal.PicPath = re[6].ToString(); re.Close(); con.Close(); //修改窗体出现 SthInf st = new SthInf(); st.Show(); this.Hide();//隐藏本窗体 } }