/// <summary> /// 添加学生班级信息 /// </summary> /// <param name="cla">学生班级信息</param> public void AddClass(StudentClass cla) { DataSet ds = null; try { string strSql = "INSERT INTO [USTA].[dbo].[usta_StudentClass]([className] ,[special],[remark]) VALUES (@className ,@special ,@remark)"; SqlParameter[] parameters = new SqlParameter[3]{ new SqlParameter("@className",cla.className), new SqlParameter("@special",cla.special), new SqlParameter("@remark",cla.remark) }; ds = SqlHelper.ExecuteDataset(conn, CommandType.Text, strSql, parameters); } catch (Exception ex) { MongoDBLog.LogRecord(ex); CommonUtility.RedirectUrl(); } finally { conn.Close(); } }
/// <summary> /// 更新学生班级信息 /// </summary> /// <param name="cla">学生班级信息</param> public void UpdateClass(StudentClass cla) { DataSet ds = null; try { string strSql = "UPDATE [USTA].[dbo].[usta_StudentClass] SET [className] = @className ,[special] = @special ,[remark] = @remark WHERE classId=@classId"; SqlParameter[] parameters = new SqlParameter[4]{ new SqlParameter("@classId",cla.classId), new SqlParameter("@className",cla.className), new SqlParameter("@special",cla.special), new SqlParameter("@remark",cla.remark) }; ds = SqlHelper.ExecuteDataset(conn, CommandType.Text, strSql, parameters); } catch (Exception ex) { MongoDBLog.LogRecord(ex); CommonUtility.RedirectUrl(); } finally { conn.Close(); } }