public List <PojoGaleria> obtenerAutobus() { try { List <PojoGaleria> concep = new List <PojoGaleria>(); PojoGaleria pojoAmbu; MySqlCommand cm = new MySqlCommand(); MySqlDataReader dr; cone.conexion(); string sql = " select destino from galeria"; cm.CommandText = sql; cm.CommandType = CommandType.Text; cm.Connection = cone.conectar; dr = cm.ExecuteReader(); while (dr.Read()) { pojoAmbu = new PojoGaleria(); pojoAmbu.Destino = dr.GetString("destino"); concep.Add(pojoAmbu); } return(concep); } catch (Exception exc) { return(null); } finally { cone.conectar.Close(); } }
public string insertar(PojoGaleria pojoGaleria) { MySqlCommand cmd = new MySqlCommand(); conec.conexion(); cmd.Parameters.AddWithValue("@idGaleria", pojoGaleria.IdGaleria); cmd.Parameters.AddWithValue("@idUsuario", pojoGaleria.IdUsuario); cmd.Parameters.AddWithValue("@titulo", pojoGaleria.Titulo); cmd.Parameters.AddWithValue("@img_galeria", pojoGaleria.Img_galeria); string consul = "insert into galeria(idGaleria, idUsuario, titulo,img_galeria)VALUES(null,@idUsuario,@titulo,@img_galeria)"; cmd.CommandText = consul; cmd.CommandType = CommandType.Text; cmd.Connection = conec.conectar; cmd.ExecuteNonQuery(); conec.conectar.Close(); return("Guardado"); }
public List <PojoGaleria> obtenerrutas(string clave) { //try //{ List <PojoGaleria> concep = new List <PojoGaleria>(); PojoGaleria pojoAmbu; MySqlCommand cm = new MySqlCommand(); MySqlDataReader dr; cone.conexion(); string sql = " select img_galeria from galeria where destino='" + clave + "'"; cm.CommandText = sql; cm.CommandType = CommandType.Text; cm.Connection = cone.conectar; dr = cm.ExecuteReader(); while (dr.Read()) { pojoAmbu = new PojoGaleria(); pojoAmbu.Img_galeria = dr.GetString("img_galeria"); concep.Add(pojoAmbu); } return(concep); //} //catch (Exception exc) //{ // return null; //} //finally //{ cone.conectar.Close(); //} }