Borrar
Upcoming SlideShare
Loading in...5
×
 
  • 1,136 views

 

Statistics

Views

Total Views
1,136
Views on SlideShare
642
Embed Views
494

Actions

Likes
0
Downloads
17
Comments
0

1 Embed 494

http://ilianpatricia18.wordpress.com 494

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Borrar Borrar Presentation Transcript

  • borrar
    CLIENTE
    PROVEEDOR
    PRODUCTO
    VENTAS
  • private void Form20_Load(object sender, EventArgs e)
    {
    DataSet TABLA;
    SqlDataAdapter ORDEN;
    con = new SqlConnection();
    con.ConnectionString = vgloba.liga;
    string q = "select * from PRODUCTOS";
    ORDEN = new SqlDataAdapter(q, con);
    // Creando el dataset y cargandolo
    TABLA = new DataSet();
    ORDEN.Fill(TABLA, "PRODUCTOS");
    // Cargando el datagridview
    dataGridView1.DataSource = TABLA;
    dataGridView1.DataMember = "PRODUCTOS";
    }
  • ESTE CODIGO VA DENTRO DEL BOTON.
    private void button3_Click(object sender, EventArgs e)
    {
    con = new SqlConnection();
    con.ConnectionString = vgloba.liga;
    try
    {
    con.Open();
    con = new SqlConnection();
    con.ConnectionString = vgloba.liga;
    string buscar = "SELECT * from PRODUCTOS where ID_PRODUCTO= '" + textBox1.Text + "'";
    SqlCommand ORDEN = new SqlCommand(buscar, con);
    ORDEN.Connection.Open();
    ORDEN.ExecuteNonQuery();
    SqlDataReaderreader = ORDEN.ExecuteReader();
    reader.Read();
    if (reader.HasRows)
    {
  • //SqlCommand ORDER;
    con = new SqlConnection();
    con.ConnectionString = vgloba.liga;
    if (MessageBox.Show("¿Eliminar el PRODUCTO" + textBox1.Text + "?", "Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
    string eliminar = "DELETE FROM PRODUCTOS WHERE ID_PRODUCTO='" + textBox1.Text + "'";
    SqlCommand ORDEN2 = new SqlCommand(eliminar, con);
    ORDEN2.Connection.Open();
    ORDEN2.ExecuteNonQuery();
    MessageBox.Show("PRODUCTO ELIMINADO");
    textBox1.Text = "";
    }
    else
    {
    MessageBox.Show("No se puede eliminar el PRODUCTO");
    }
    }
    else
    {
    MessageBox.Show("El ID proporcionado no existe");
    textBox1.Text = "";
    }
    }
    catch
    {
    MessageBox.Show("Conexion fallida");
    }
    Form18 ventana = new Form18();
    ventana.Show();
    this.Close();
    }
    }
  • ESTE MISMO CODIGO SE UTILIZA EN LAS DEMAS VENTANAS PERO CON SU RESPECTIVOS DATOS DE LA BASE DE DATOS.