Пример #1
0
        public static void fillcb(ComboBox combo_box, string _string)
        {
            DataTable dt = BBDDComun.GetMysqltable(_string);

            foreach (DataRow row in dt.Rows)
            {
                string wine = string.Format("{0}", row.ItemArray[0]);
                combo_box.Items.Add(wine);
            }
        }
Пример #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            MySqlCommand command = new MySqlCommand("DELETE FROM PRODUCTOS WHERE PRODUCTO_ID =@id", conexion);

            command.Parameters.Add("@id", MySqlDbType.Int32).Value = textBox4.Text;

            ExecMyQuery(command, "Datos Eliminados");

            dat.DataSource = BBDDComun.GetMysqltable("SELECT PRODUCTO_ID,CATEGORIA_ID,NOMBRE,PRECIO,DESCRIPCION,IMAGEN,MARCA FROM PRODUCTOS;");
        }
Пример #3
0
        private void button4_Click(object sender, EventArgs e)
        {
            MySqlCommand command = new MySqlCommand("DELETE FROM TIPO_PRODUCTOS WHERE ID =@id", conexion);

            command.Parameters.Add("@id", MySqlDbType.Int32).Value = textBox1.Text;

            ExecMyQuery(command, "Datos Eliminados");
            Limpiar();
            dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,CATEGORIA,IMAGEN FROM TIPO_PRODUCTOS;");
        }
        private void button4_Click(object sender, EventArgs e)
        {
            MySqlCommand command = new MySqlCommand("DELETE FROM USUARIOS WHERE ID =@id", conexion);

            command.Parameters.Add("@id", MySqlDbType.Int32).Value = id.Text;

            ExecMyQuery(command, "Datos Eliminados");
            Limpiar();
            dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,NOMBRE,APELLIDO,CORREO FROM USUARIOS;");
        }
        public static int SendCommand(string _string)
        {
            int             retorno  = 0;
            MySqlConnection conexion = BBDDComun.Obtenerconexion();
            MySqlCommand    comando  = new MySqlCommand(_string, conexion);

            try {
                retorno = comando.ExecuteNonQuery();
                conexion.Close();
            } catch (MySqlException ex) {
                int errocode = ex.Number;
                MessageBox.Show(ex.Message + "N error:" + errocode);
            }
            return(retorno);
        }
        private void button3_Click(object sender, EventArgs e)
        {
            MySqlCommand command = new MySqlCommand("UPDATE MARCA SET NOMBRE =@tipo_producto WHERE ID=@id", conexion);

            command.Parameters.Add("@tipo_producto", MySqlDbType.VarChar).Value = marca.Text;



            command.Parameters.Add("@id", MySqlDbType.Int32).Value = usuario.Text;

            ExecMyQuery(command, "ACTUALIZADO");


            dat.DataSource = BBDDComun.GetMysqltable("SELECT *FROM MARCA;");
        }
Пример #7
0
 private void button2_Click(object sender, EventArgs e)
 {
     /*
      * conexion.Open();
      * MySqlCommand mostrar = new MySqlCommand("SELECT * FROM TIPO_PRODUCTOS", conexion);
      *
      * MySqlDataAdapter m_datos = new MySqlDataAdapter(mostrar);
      * ds = new DataSet();
      *
      * m_datos.Fill(ds);
      * dat.DataSource = ds.Tables[0];
      * conexion.Close();
      *
      *
      */
     dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,CATEGORIA,IMAGEN FROM TIPO_PRODUCTOS;");
 }
Пример #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            try{
                MemoryStream ms = new MemoryStream();
                pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
                byte[] img = ms.ToArray();

                MySqlCommand command = new MySqlCommand("INSERT INTO TIPO_PRODUCTOS(CATEGORIA,IMAGEN) VALUES (@tipo_producto,@imagen)", conexion);

                command.Parameters.Add("@tipo_producto", MySqlDbType.VarChar).Value = txtNombre.Text;
                command.Parameters.Add("@imagen", MySqlDbType.LongBlob).Value       = img;
                ExecMyQuery(command, "Datos Insertados");

                dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,CATEGORIA,IMAGEN FROM TIPO_PRODUCTOS;");
            }catch (Exception ex) {
                throw new Exception(ex.Message);
            }
        }
Пример #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            MemoryStream ms = new MemoryStream();

            pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
            byte[] img = ms.ToArray();

            MySqlCommand command = new MySqlCommand("UPDATE TIPO_PRODUCTOS SET CATEGORIA =@tipo_producto,IMAGEN=@imagen WHERE ID=@id", conexion);

            command.Parameters.Add("@id", MySqlDbType.Int32).Value = textBox1.Text;
            command.Parameters.Add("@tipo_producto", MySqlDbType.VarChar).Value = txtNombre.Text;
            command.Parameters.Add("@imagen", MySqlDbType.LongBlob).Value       = img;

            ExecMyQuery(command, "ACTUALIZADO");


            dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,CATEGORIA,IMAGEN FROM TIPO_PRODUCTOS;");
            Limpiar();
        }
Пример #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand command = new MySqlCommand("INSERT INTO MARCA (NOMBRE,PAIS_ORIGEN) VALUES (@tipo_producto,@pais)", conexion);

                command.Parameters.Add("@tipo_producto", MySqlDbType.VarChar).Value = marca.Text;
                command.Parameters.Add("@pais", MySqlDbType.VarChar).Value          = pais.Text;


                ExecMyQuery(command, "Datos Insertados");

                dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,NOMBRE,PAIS_ORIGEN FROM MARCA;");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        private void button3_Click(object sender, EventArgs e)
        {
            MySqlCommand command = new MySqlCommand("UPDATE USUARIOS SET NOMBRE =@tipo_producto, APELLIDO=@apellido,CLAVE=@contra WHERE ID=@id", conexion);

            command.Parameters.Add("@tipo_producto", MySqlDbType.VarChar).Value = txtNombre.Text;

            command.Parameters.Add("@apellido", MySqlDbType.VarChar).Value = apellido.Text;

            command.Parameters.Add("@correo", MySqlDbType.VarChar).Value = correo.Text;

            command.Parameters.Add("@contra", MySqlDbType.VarChar).Value = contra.Text;
            command.Parameters.Add("@id", MySqlDbType.Int32).Value       = id.Text;

            ExecMyQuery(command, "ACTUALIZADO");


            dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,NOMBRE,APELLIDO,CORREO,TELEFONO FROM USUARIOS;");
            Limpiar();
        }
Пример #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            try {
                MemoryStream ms = new MemoryStream();
                pictureBox2.Image.Save(ms, pictureBox2.Image.RawFormat);
                byte[] img = ms.ToArray();

                MySqlCommand command = new MySqlCommand("INSERT INTO PRODUCTOS (CATEGORIA_ID,NOMBRE,PRECIO,DESCRIPCION,IMAGEN,MARCA,ID_USUARIO) VALUES (@categoria_id,@nombre,@precio,@descripcion,@imagen,@marca,@idusuario)", conexion);

                command.Parameters.Add("@categoria_id", MySqlDbType.Int32).Value  = textBox2.Text;
                command.Parameters.Add("@nombre", MySqlDbType.VarChar).Value      = txtNombre.Text;
                command.Parameters.Add("@precio", MySqlDbType.Int32).Value        = precio.Text;
                command.Parameters.Add("@descripcion", MySqlDbType.VarChar).Value = genero.Text;
                command.Parameters.Add("@imagen", MySqlDbType.LongBlob).Value     = img;
                command.Parameters.Add("@marca", MySqlDbType.VarChar).Value       = textBox3.Text;
                command.Parameters.Add("@idusuario", MySqlDbType.Int32).Value     = iduser.Text;

                ExecMyQuery(command, "Datos Insertados");

                dat.DataSource = BBDDComun.GetMysqltable("SELECT PRODUCTO_ID,CATEGORIA_ID,NOMBRE,PRECIO,DESCRIPCION,IMAGEN,MARCA FROM PRODUCTOS;");
            }catch (Exception ex) {
                throw new Exception(ex.Message);
            }
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                MySqlCommand command = new MySqlCommand("INSERT INTO USUARIOS (NOMBRE,APELLIDO,CORREO,CLAVE,TELEFONO) VALUES (@tipo_producto,@apellido,@correo,@contra,@tel)", conexion);

                command.Parameters.Add("@tipo_producto", MySqlDbType.VarChar).Value = txtNombre.Text;

                command.Parameters.Add("@apellido", MySqlDbType.VarChar).Value = apellido.Text;

                command.Parameters.Add("@correo", MySqlDbType.VarChar).Value = correo.Text;

                command.Parameters.Add("@contra", MySqlDbType.VarChar).Value = contra.Text;
                command.Parameters.Add("@tel", MySqlDbType.Int32).Value      = telefono.Text;

                ExecMyQuery(command, "Datos Insertados");

                dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,NOMBRE,APELLIDO,CORREO,TELEFONO FROM USUARIOS;");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Пример #14
0
 private void button2_Click(object sender, EventArgs e)
 {
     dat.DataSource = BBDDComun.GetMysqltable("SELECT PRODUCTO_ID,CATEGORIA_ID,NOMBRE,PRECIO,DESCRIPCION,IMAGEN,MARCA,ID_USUARIO FROM PRODUCTOS;");
 }
Пример #15
0
 private void button2_Click(object sender, EventArgs e)
 {
     dat.DataSource = BBDDComun.GetMysqltable("SELECT *from MARCA;");
 }
 private void button2_Click(object sender, EventArgs e)
 {
     dat.DataSource = BBDDComun.GetMysqltable("SELECT ID,NOMBRE,APELLIDO,CORREO,TELEFONO FROM USUARIOS;");
 }