コード例 #1
0
        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();
            }
        }
コード例 #2
0
ファイル: DaoGaleria.cs プロジェクト: Juanj123/Excursiones
        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");
        }
コード例 #3
0
        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();
            //}
        }