private void EDIT(int tab) { if (SelectNO == "") { MessageBox.Show("未选中数据!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } switch (tab) { case 0: student mystudent = new student("编辑", SelectNO); mystudent.StartPosition = FormStartPosition.CenterParent; mystudent.ShowDialog(); if (mystudent.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mystudent.QString); ReadAllStudent(); } break; case 1: course mycourse = new course("编辑", SelectNO); mycourse.StartPosition = FormStartPosition.CenterParent; mycourse.ShowDialog(); if (mycourse.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mycourse.QString); ReadAllCourse(); } break; case 2: teacher myteacher = new teacher("编辑", SelectNO); myteacher.StartPosition = FormStartPosition.CenterParent; myteacher.ShowDialog(); if (myteacher.DialogResult == DialogResult.OK) { sql.ExecuteQuery(myteacher.QString); ReadAllTeacher(); } break; case 3: department mydept = new department("编辑", SelectNO); mydept.StartPosition = FormStartPosition.CenterParent; mydept.ShowDialog(); if (mydept.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mydept.QString); ReadAllDept(); } break; case 4: sct mysct = new sct("编辑", SelectNO); mysct.StartPosition = FormStartPosition.CenterParent; mysct.ShowDialog(); if (mysct.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mysct.QString); ReadAllSct(); } break; default: break; } }
private void ADD(int tab) { switch (tab) { case 0: student mystudent = new student("添加"); mystudent.StartPosition = FormStartPosition.CenterParent; mystudent.ShowDialog(); if (mystudent.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mystudent.QString); ReadAllStudent(); } break; case 1: course mycourse = new course("添加"); mycourse.StartPosition = FormStartPosition.CenterParent; mycourse.ShowDialog(); if (mycourse.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mycourse.QString); ReadAllCourse(); } break; case 2: teacher myteacher = new teacher("添加"); myteacher.StartPosition = FormStartPosition.CenterParent; myteacher.ShowDialog(); if (myteacher.DialogResult == DialogResult.OK) { sql.ExecuteQuery(myteacher.QString); ReadAllTeacher(); } break; case 3: department mydept = new department("添加"); mydept.StartPosition = FormStartPosition.CenterParent; mydept.ShowDialog(); if (mydept.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mydept.QString); ReadAllDept(); } break; case 4: sct mysct = new sct("添加"); mysct.StartPosition = FormStartPosition.CenterParent; mysct.ShowDialog(); if (mysct.DialogResult == DialogResult.OK) { sql.ExecuteQuery(mysct.QString); ReadAllSct(); } break; default: break; } }