Пример #1
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            FConfirmacion confirmacion = new FConfirmacion();

            confirmacion.ShowDialog();
            if (confirmacion.DialogResult == DialogResult.OK)
            {
                string ConnString = Clases.Variables.scon;
                string SqlString  = "Delete from subdireccion where ID=" + Clases.Variables.IdSubD;
                try
                {
                    SqlConnection conn = new SqlConnection(ConnString);
                    SqlCommand    cmd  = new SqlCommand(SqlString, conn);
                    cmd.CommandType = CommandType.Text;
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    MessageBox.Show("SubDireccion eliminada correctamente.");
                    Clases.LLenadoGrids.llenarGrid(GridSubD, Clases.Variables.ConsultaBuscar, "subdireccion");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("El valor no se pudo eliminar. \n" + ex.ToString());
                }
            }
        }
Пример #2
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            FConfirmacion fConfirmacion = new FConfirmacion();

            fConfirmacion.ShowDialog();
            if (fConfirmacion.DialogResult == DialogResult.OK)
            {
                string ConnString = Clases.Variables.scon;
                string SqlString  = "Delete from CatArticulos where Descripcion='" + Clases.Variables.ArticuloDescripcion + "'";
                try
                {
                    SqlConnection conn = new SqlConnection(ConnString);
                    SqlCommand    cmd  = new SqlCommand(SqlString, conn);
                    cmd.CommandType = CommandType.Text;
                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();
                    MessageBox.Show("Articulo eliminado correctamente.");
                    Clases.LLenadoGrids.llenarGrid(GVCatArticulos, Clases.Variables.ConsultaBuscar, "vArticulosCompras");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("El valor seleccionado no es valido. \n" + ex.ToString());
                }
            }
        }