Example #1
0
        private void CargarTabla()
        {
            con = new SqlConnection("Data Source=DESKTOP-7UG5AJD\\SQLEXPRESS02;Initial Catalog=RentCar;Integrated Security=True");
            con.Open();
            string         sql = "select * from InspeccionV ";
            SqlDataAdapter da  = new SqlDataAdapter(sql, con);
            DataTable      dt  = new DataTable();

            da.Fill(dt);
            DgvInspeccion.DataSource = dt;
            DgvInspeccion.Refresh();

            con.Close();
        }
Example #2
0
        private void CargarTabla()
        {
            if (con.State != ConnectionState.Open)
            {
                con.Open();
            }
            string         sql = "select * from InspeccionV ";
            SqlDataAdapter da  = new SqlDataAdapter(sql, con);
            DataTable      dt  = new DataTable();

            da.Fill(dt);
            DgvInspeccion.DataSource = dt;
            DgvInspeccion.Refresh();

            con.Close();
        }
Example #3
0
        private void BtBorrar_Click(object sender, EventArgs e)
        {
            try
            {
                con = new SqlConnection("Data Source=DESKTOP-7UG5AJD\\SQLEXPRESS02;Initial Catalog=RentCar;Integrated Security=True");
                con.Open();
                string     sql     = "DELETE FROM InspeccionV WHERE IdVehiculos = " + "'" + TxtIdInspeccion.Text + "'" + "";
                SqlCommand comando = new SqlCommand(sql, con);
                comando.ExecuteNonQuery();


                MessageBox.Show("Registro Borrado");
                DgvInspeccion.Refresh();
                con.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Ha ocurrido un error");
            }
        }
Example #4
0
        private void BtBorrar_Click(object sender, EventArgs e)
        {
            try
            {
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                string     sql     = "DELETE FROM InspeccionV WHERE IdVehiculos = " + "'" + TxtIdInspeccion.Text + "'" + "";
                SqlCommand comando = new SqlCommand(sql, con);
                comando.ExecuteNonQuery();


                MessageBox.Show("Registro Borrado");
                DgvInspeccion.Refresh();
                con.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Ha ocurrido un error");
            }
        }