error 40 en Mysql
Publicado por Percibal (1 intervención) el 23/01/2020 19:26:12
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
SqlConnection con = new SqlConnection("Server=localhost;Database=bodegacopcisa; Uid=root; Password=Murdo68736");
public void logear(string Rut, string Pass)
{
try
{
con.Open();
SqlCommand cmd = new SqlCommand("SELECT * FROM usuario WHERE Rut =Rut AND contrase =Pass", con);
cmd.Parameters.AddWithValue("Rut",Rut);
cmd.Parameters.AddWithValue("contrase", Pass);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
if (dt.Rows.Count ==1)
{
this.Hide();
if (dt.Rows[4].ToString()== "Administrador")
{
new Form3(dt.Rows[1].ToString()).Show();
} else if (dt.Rows[4].ToString()=="Usuario")
{
new Form2(dt.Rows[1].ToString()).Show();
}
}
else
{
MessageBox.Show("usuario y/o contraseña incorrectos");
}
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
finally {
con.Close();
}
}
private void button1_Click(object sender, EventArgs e)
{
logear(this.txt_Rut.Text, this.txt_contrase.Text);
}

y estoy programando de manera local en c#
Valora esta pregunta


0