private void btLogClient_Click(object sender, EventArgs e) { MySqlConnection conectaruser = new MySqlConnection("server=localhost; database=datos_proyecto; UID=root; password=;"); conectaruser.Open(); MySqlCommand codigo = new MySqlCommand(); MySqlConnection conectanos = new MySqlConnection(); codigo.Connection = conectaruser; codigo.CommandText = ("Select *from clientes where nombre ='" + tbNickUser.Text + "'and contraseña = '" + tbPassUser.Text + "'and TipoPersona= '" + 1 + "'"); MySqlDataReader leer = codigo.ExecuteReader(); if (leer.Read()) { MessageBox.Show("Bienvenido " + tbNickUser.Text); int id = searchIdByName(tbNickUser.Text); FormShop shop = new FormShop(); shop.lbIdUser.Text = "" + id; shop.Show(); this.Hide(); } else { MessageBox.Show("Usuario o contraseña incorrectos"); } conectaruser.Close(); }
private void btBack_Click(object sender, EventArgs e) { FormShop shop = new FormShop(); shop.Show(); this.Close(); }