private void load() { if (BOOL == choose.student) { button1.Text = "修改"; foreach (StudentMessage ss in StudentList.selectAllStudent()) { if (ss.id.Equals(s)) { show(); this.dgv.Columns.Add("电话", null); this.dgv.Columns.Add("宿舍号", null); this.dgv.Columns.Add("项目", null); this.dgv.Columns.Add("状态", null); this.dgv.Rows.Add(ss.phone, ss.dorms, ss.project, ss.states); stu = ss; } } } else { button1.Text = "修改报修状态"; MySqlConnection myConnection; myConnection = database.open(); MySqlDataAdapter ada = new MySqlDataAdapter("select *from student", myConnection); myConnection.Open(); DataSet ds = new DataSet(); ada.Fill(ds, "student"); //ds.Tables.Add(Get("https://localhost:44396/api/students/getStudent")); dgv.DataSource = ds; dgv.DataMember = "student"; myConnection.Close(); } }
private void button1_Click(object sender, EventArgs e) { int i; if (BOOL == choose.drom) { i = dgv.CurrentRow.Index; s = dgv.Rows[i].Cells["xuehao"].Value.ToString(); MessageBox.Show(s); foreach (StudentMessage ss in StudentList.selectAllStudent()) { if (ss.id.Equals(s)) { stu = ss; } } } alter a = new alter(stu, BOOL); a.Show(); }