예제 #1
0
        public static Disco sqlLeer(Disco disco)
        {
            String sql = "Select * from disco where id = '" + disco.Id + "'";
            BD bd = Conexion.BD.getInstance();
            bd.sqlSelect(sql);

            DataTable dt = BD.getInstance().sqlSelect(sql);

            if (dt.Rows.Count == 0)
            {
                return null;
            }

            disco.Id = int.Parse(dt.Rows[0]["id"].ToString());
            disco.Nombre = dt.Rows[0]["nombre"].ToString();
            disco.IdArtista = int.Parse(dt.Rows[0]["idArtista"].ToString());
            disco.Precio = int.Parse(dt.Rows[0]["precio"].ToString());
            return disco;
        }
예제 #2
0
 public static Boolean sqlUpdate(Disco disco)
 {
     string sql = "Update disco set nombre  = '" + disco.Nombre + "', idArtista = '" + disco.IdArtista + "', precio = '" + disco.Precio + "' where id = '" + disco.Id + "'";
     BD bd = Conexion.BD.getInstance();
     bd.sqlEjecutar(sql);
     return true;
 }
예제 #3
0
 public static Boolean sqlInsert(Disco disco)
 {
     String sql = "Insert into disco (id, nombre, idArtista, precio) values ('" + disco.Id + "','" + disco.Nombre + "', '" + disco.IdArtista + "', '" + disco.Precio + "')";
     BD bd = Conexion.BD.getInstance();
     return bd.sqlEjecutar(sql);
 }
예제 #4
0
 public static Boolean sqlDelete(Disco disco)
 {
     String sql = "Delete from disco where id = '" + disco.Id + "'";
     BD bd = Conexion.BD.getInstance();
       return bd.sqlEjecutar(sql);
 }