1、0 AND LoginPwd=1, loginId, loginPwd); try SqlCommand command = new SqlCommand(sql, ; count = (int)(); if (count = 1) isValidUser = true; else index+; if (index (); isValidUser = false; catch (Exception ex) message = ; ;查询修改信息查询教师基本信息(代码区域: TeacherBaseForm teacherBaseForm = new TeacherBaseForm();Teac
2、herBaseForm(教师基本信息窗体)查询及修改学生信息(代码区域: UpdateStudentForm updateStudentForm = new UpdateStudentForm();(查询及修改信息窗体)AddScoreForm(学生成绩录入窗体)录入按钮代码:string sql = (select StudentId,StudentNo,StudentName from Student where StudentId=, ; SqlDataReader reader = (); while () id = (int)readerStudentId; no = (string
3、)readerStudentNo name = (string)readerStudentName finally if (TianJia() if = (id) & = no & = name) string studentName = ; string sdudentNo = ; string subject = ; string score = ; int classId = GetClassId(); string studentId = ; string sql1 = (insert into Score(StudentNo,Subject,SScore,SName,ClassId,
4、StudentId)values(,234,5), sdudentNo, subject, score, studentName, classId, studentId); SqlCommand command = new SqlCommand(sql1, ; int result = (); if (result != 1) (添加失败, 输入提示, , ;添加成功 /(操作数据库出错! /;您输入的学生在数据库中没有,请重新输入 private void AddScoreForm_Load(object sender, EventArgs e) string sql = select gr
5、adeName from Grade string gradeName = (string)reader0; string sql1 = select SubjectName from Subject string subName = (string)reader0; private void cboGrade_SelectedIndexChanged(object sender, EventArgs e) if != int gradeId = -1;select GradeId from Grade where GradeName= if () gradeId = (int)reader0
6、;操作数据库出错); sql = SELECT ClassName FROM Class WHERE GradeId= + gradeId; = sql; string className = className = (string)readerClassName private void txtId_TextChanged(object sender, EventArgs e)UpdateScoreForm(更新成绩窗体)保存按钮代码:DialogResult result = (确实要将修改保存到数据库吗 if (result = SqlCommandBuilder builder = new SqlCommandBuilder(dataAdapter); (dataSet, Score保存成功保存失败
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1