public EventosType select(int idAssociacao) { MySqlConnection con = new MySqlConnection(Dados.StringConexao); string SQL = "SELECT * FROM evento WHERE id_associacao = @idAssociacao ORDER BY data_ini DESC"; MySqlCommand cmd = new MySqlCommand(SQL, con); cmd.Parameters.AddWithValue("@idAssociacao", idAssociacao); con.Open(); MySqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); EventosType eventos = new EventosType(); while (dr.Read()) { EventoType evento = new EventoType(); evento.idEvento = Int32.Parse(dr["id_evento"].ToString()); evento.idAssociacao = Int32.Parse(dr["id_associacao"].ToString()); evento.Titulo = dr["titulo"].ToString(); evento.Descricao = dr["descricao"].ToString(); evento.Local = dr["local"].ToString(); evento.dataIni = dr["data_ini"].ToString(); evento.dataEnd = dr["data_fim"].ToString(); eventos.Add(evento); } return(eventos); }
public EventosType select(int idAssociacao) { MySqlConnection con = new MySqlConnection(Dados.StringConexao); string SQL = "SELECT * FROM evento WHERE id_associacao = @idAssociacao ORDER BY data_ini DESC"; MySqlCommand cmd = new MySqlCommand(SQL, con); cmd.Parameters.AddWithValue("@idAssociacao", idAssociacao); con.Open(); MySqlDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); EventosType eventos = new EventosType(); while (dr.Read()) { EventoType evento = new EventoType(); evento.idEvento = Int32.Parse(dr["id_evento"].ToString()); evento.idAssociacao = Int32.Parse(dr["id_associacao"].ToString()); evento.Titulo = dr["titulo"].ToString(); evento.Descricao = dr["descricao"].ToString(); evento.Local = dr["local"].ToString(); evento.dataIni = dr["data_ini"].ToString(); evento.dataEnd = dr["data_fim"].ToString(); eventos.Add(evento); } return eventos; }
protected void Page_Load(object sender, EventArgs e) { EventoBLL bll = new EventoBLL(); eventos = bll.select(Master.AssociacaoIdCookie); }
protected void Page_Load(object sender, EventArgs e) { EventoBLL bll = new EventoBLL(); eventos = bll.select(Master.AssociacaoIdCookie); }