Exemplo n.º 1
0
 public static Boolean sqlUpdate(Artista artista)
 {
     string sql = "Update artista set nombre = '" + artista.Nombre + "', idGenero = '" + artista.IdGenero + "' where id = '" + artista.Id + "'";
     BD bd = Conexion.BD.getInstance();
     bd.sqlEjecutar(sql);
     return true;
 }
Exemplo n.º 2
0
 protected void btAgregar_Click(object sender, EventArgs e)
 {
     if (validar())
     {
         int idGenero = int.Parse(cbGenero.SelectedValue);
         Artista artista = new Artista(int.Parse(txId.Text), txNombre.Text, idGenero);
         if (!DAOArtista.sqlInsert(artista))
         {
             lbMensaje.Text = "Error. No se pudo agregar el artista, porque ya existe";
         }
         else
         {
             lbMensaje.Text = "Artista agregado exitosamente";
         }
     }
 }
Exemplo n.º 3
0
        public static Artista sqlLeer(Artista artista)
        {
            String sql = "Select * from artista where id = '" + artista.Id + "'";
            BD bd = Conexion.BD.getInstance();
            bd.sqlSelect(sql);

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

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

            artista.Id = int.Parse(dt.Rows[0]["id"].ToString());
            artista.Nombre = dt.Rows[0]["nombre"].ToString();
            artista.IdGenero = int.Parse(dt.Rows[0]["idGenero"].ToString());

            return artista;
        }
Exemplo n.º 4
0
 public static Boolean sqlInsert(Artista artista)
 {
     String sql = "Insert into artista (id, nombre, idGenero) values ('" + artista.Id + "','" + artista.Nombre + "', '" + artista.IdGenero + "')";
     BD bd = Conexion.BD.getInstance();
     return bd.sqlEjecutar(sql);
 }
Exemplo n.º 5
0
 public static Boolean sqlDelete(Artista artista)
 {
     String sql = "Delete from artista where id = '" + artista.Id + "'";
     BD bd = Conexion.BD.getInstance();
        return bd.sqlEjecutar(sql);
 }