/// <summary> /// 增加一条数据 /// </summary> public int Add(GameEnrollList model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into usta_GameEnrollList("); strSql.Append("teacherNo,gameCategoryId,gameTypeId,updateTime)"); strSql.Append(" values ("); strSql.Append("@teacherNo,@gameCategoryId,@gameTypeId,@updateTime)"); SqlParameter[] parameters = { new SqlParameter("@teacherNo", SqlDbType.NVarChar,50), new SqlParameter("@gameCategoryId", SqlDbType.Int,4), new SqlParameter("@gameTypeId", SqlDbType.Int,4), new SqlParameter("@updateTime", SqlDbType.Date)}; parameters[0].Value = model.teacherNo; parameters[1].Value = model.gameCategoryId; parameters[2].Value = model.gameTypeId; parameters[3].Value = model.updateTime; return SqlHelper.ExecuteNonQuery(conn,CommandType.Text, strSql.ToString(), parameters); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(GameEnrollList model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update usta_GameEnrollList set "); strSql.Append("teacherNo=@teacherNo,"); strSql.Append("gameCategoryId=@gameCategoryId,"); strSql.Append("gameTypeId=@gameTypeId"); strSql.Append(" where gameEnrollListId=@gameEnrollListId"); SqlParameter[] parameters = { new SqlParameter("@teacherNo", SqlDbType.NVarChar,50), new SqlParameter("@gameCategoryId", SqlDbType.Int,4), new SqlParameter("@gameTypeId", SqlDbType.Int,4), new SqlParameter("@gameEnrollListId", SqlDbType.Int,4)}; parameters[0].Value = model.teacherNo; parameters[1].Value = model.gameCategoryId; parameters[2].Value = model.gameTypeId; parameters[3].Value = model.gameEnrollListId; return SqlHelper.ExecuteNonQuery(conn, CommandType.Text, strSql.ToString(), parameters); }