/// <summary> /// 更新一条数据 /// </summary> public bool Update(SeatManage.ClassModel.AMS_AdvertUsage model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update AMS_AdvertUsage set "); strSql.Append("AdvertID=@AdvertID,"); strSql.Append("AdvertUsage=@AdvertUsage,"); strSql.Append("LastUpdateTime=@LastUpdateTime"); strSql.Append(" where ID=@ID "); SqlParameter[] parameters = { new SqlParameter("@AdvertID", SqlDbType.Int, 4), new SqlParameter("@AdvertUsage", SqlDbType.Text), new SqlParameter("@LastUpdateTime", SqlDbType.DateTime), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.AdvertID; parameters[1].Value = model.ToXml(); parameters[2].Value = model.LastUpdateTime; parameters[3].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(SeatManage.ClassModel.AMS_AdvertUsage model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into AMS_AdvertUsage("); strSql.Append("AdvertID,AdvertUsage,LastUpdateTime)"); strSql.Append(" values ("); strSql.Append("@AdvertID,@AdvertUsage,@LastUpdateTime)"); SqlParameter[] parameters = { new SqlParameter("@AdvertID", SqlDbType.Int, 4), new SqlParameter("@AdvertUsage", SqlDbType.Text), new SqlParameter("@LastUpdateTime", SqlDbType.DateTime) }; parameters[0].Value = model.AdvertID; parameters[1].Value = model.ToXml(); parameters[2].Value = model.LastUpdateTime; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }