//实现右键添加选择题的功能 private void 添加ToolStripMenuItem_Click(object sender, EventArgs e) { AltSel se = new AltSel(); se.Show(); this.Hide();//隐藏本窗体 }
//实现右键修改选中选择题的功能 private void 修改ToolStripMenuItem_Click(object sender, EventArgs e) { int MMid = Convert.ToInt32(dataGridView1.SelectedCells[0].Value); //获取选择试题的ID值 string sql = "select * from TestInfo where ID=" + MMid + ""; OleDbConnection con = DataClass.DBCon(); con.Open(); OleDbCommand com = new OleDbCommand(sql, con); OleDbDataReader re = com.ExecuteReader(); re.Read(); //传递选择题数据 ComVal.TeID = MMid; ComVal.seTi = re[2].ToString(); ComVal.seR = re[3].ToString(); ComVal.seA = re[4].ToString(); ComVal.seB = re[5].ToString(); ComVal.seC = re[6].ToString(); ComVal.seD = re[7].ToString(); re.Close(); con.Close(); //选择题窗体出现 AltSel se = new AltSel(); se.Show(); this.Hide(); //隐藏本窗体 }