/// <summary> /// 修改学生成绩 /// </summary> /// <param name="model"></param> public int UpdateExamination(int r, List <ExaminationModel> model) { List <string> sqllist = new List <string>();//初始化一个List列表(命令列表) for (int i = 0; i < r; i++) { string sql = string.Format("update Examination set ExamScore={0} where StudentID={1} and SubjectsID={2}", model[i].ExamScore, model[i].StudentID, model[i].SubjectsID); sqllist.Add(sql); } return(SqlHelper.BeginTranExecNoneQuery(sqllist)); }
/// <summary> /// 添加学生成绩 /// </summary> /// <param name="model"></param> public int AddExamination(int r, List <ExaminationModel> model) { List <string> sqllist = new List <string>();//初始化一个List列表(命令列表) for (int i = 0; i < r; i++) { string sql = string.Format("insert into Examination values({0},{1},{2})", model[i].StudentID, model[i].SubjectsID, model[i].ExamScore); sqllist.Add(sql); } return(SqlHelper.BeginTranExecNoneQuery(sqllist)); }