Example #1
0
        private void RenaPrecio()
        {
            MySqlConnection con = BDConexicon.RenaOpen();

            try
            {
                double Precio1 = Convert.ToDouble(tbPrecio1.Text);
                double Precio2 = Convert.ToDouble(tbPrecio2.Text);
                Precio1 = Precio1 / 1.16;
                Precio2 = Precio2 / 1.16;


                MySqlCommand cmdoo = new MySqlCommand("UPDATE prods SET precio1=?precio1,precio2=?precio2  WHERE articulo=?articulo", con);
                cmdoo.Parameters.Add("?precio1", MySqlDbType.VarChar).Value  = Precio1;
                cmdoo.Parameters.Add("?precio2", MySqlDbType.VarChar).Value  = Precio2;
                cmdoo.Parameters.Add("?articulo", MySqlDbType.VarChar).Value = TB_articulo.Text;
                MySqlDataReader mdrr;
                mdrr = cmdoo.ExecuteReader();
                mdrr.Close();


                lblRePre.Text      = "OK";
                lblRePre.ForeColor = Color.DarkGreen;
            }
            catch (Exception e)
            {
                lblRePre.Text      = "N/A";
                lblRePre.ForeColor = Color.Red;
            }
            BDConexicon.RenaClose();
        }