private void BtnExaminar_Click(object sender, EventArgs e) { try { MySqlCommand cm = new MySqlCommand("select*from clientes where dni='" + TextBox5.Text + "'", cn.obtenerConeccion()); MySqlDataReader dr = cm.ExecuteReader(); if (dr.Read() == true) { TextBox4.Text = dr["nombres"].ToString(); Label10.Text = dr["idclientes"].ToString(); // Label9.Text = dr["idclientes"].ToString(); TextBox5.Text = dr["DNI"].ToString(); // textBox6ext = dr["Stock"].ToString(); textBox1.Text = ""; textBox1.Focus(); } else { MessageBox.Show("Cliente no Encontrado", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TextBox5.Text = ""; TextBox5.Focus(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { cn.DescargarConexion(); } }
private void Button2_Click(object sender, EventArgs e) { if (comboBox1.Text == "") { MessageBox.Show("Selecciona el proveedor por favor", "Sistema"); comboBox1.Text = ""; } else { String query = "insert into producto values('" + textBox1.Text + "','" + this.textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" + textBox5.Text + "','" + label8.Text + "','" + (label9.Text) + "')"; MySqlCommand cm = new MySqlCommand(query, cn.obtenerConeccion()); MySqlDataReader dr; try { dr = cm.ExecuteReader(); MessageBox.Show("Datos Guardados Corectamente", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); carga(); limpiar(); Button2.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { cn.DescargarConexion(); } } }
private void Button2_Click(object sender, EventArgs e) { String query = "insert into clientes values('" + textBox1.Text + "','" + this.textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "')"; MySqlCommand cm = new MySqlCommand(query, cn.obtenerConeccion()); MySqlDataReader dr; try { dr = cm.ExecuteReader(); MessageBox.Show("Datos Guardados Corectamente", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); carga(); limpiar(); Button2.Enabled = true; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { cn.DescargarConexion(); } }
private void ingresar() { try { string usuario; string pass; usuario = this.UsernameTextBox.Text; pass = this.PasswordTextBox.Text; MySqlCommand cm = new MySqlCommand("select*from usuario where usuario='" + usuario + "'and password ='******'", cn.obtenerConeccion()); MySqlDataReader dr; cn.obtenerConeccion(); dr = cm.ExecuteReader(); if (dr.Read() == true) { string usu; //count = count + 1; //usuariologin = dr["nombres"].ToString(); usu = dr["usuario"].ToString(); //nivel = Convert.ToInt32(dr["nivel_usu"].ToString()); //cargo = dr["cargo"].ToString(); MessageBox.Show("Bienvenido " + "Usuario " + "=>" + usu, "SystFarma 2019", MessageBoxButtons.OK, MessageBoxIcon.Information); MDIParent1 f = new MDIParent1(); f.Show(); cn.DescargarConexion(); this.Hide(); } else { MessageBox.Show("Usuario o ContraseƱa Incorrecta", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error); UsernameTextBox.Text = ""; PasswordTextBox.Text = ""; UsernameTextBox.Focus(); cn.DescargarConexion(); } } catch (Exception ex) { throw ex; } }