Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://4.bp.blogspot.com/-xtAyprS21k8/Vub4O3Q1d3I/AAAAAAAAHTI/r0bbJ5rnsSkzVaLbFqSHUZnirLfHrcDAA/s1600/2.png
- String caminhodb = "server=127.0.0.1;DATABASE=aula_ds;UID=root;PASSWORD=1234";
- MySqlConnection cn = new MySqlConnection(caminhodb);
- MySqlCommand cmd = new MySqlCommand("SELECT * FROM cad_alunos WHERE User =?user and pass =?pass", cn);
- cmd.parameters.Add("?user", MySqlDbType.VarChar).Value = textBox1.Text;
- cmd.parameters.Add("?pass", MySqlDbType.VarChar).Value = textBox2.Text;
- cn.Open();
- MySqlDataReader le = null;
- le = cmd.ExecuteReader();
- if (le.Read())
- {
- Frm_Principal menu = new Frm_Principal();
- menu.ShowDialog();
- this.Hide();
- }
- else
- {
- Message.show("Usuario ou senha incorretos!!");
- }
- }
- private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar == 13)
- {
- textBox2.Focus();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement