Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void botaoLogin_Click(object sender, EventArgs e)
- {
- string nome = user.Text;
- string senha = senhaa.Text;
- Database bd = new Database();
- bd.conecta();
- int i = 0;
- MySqlCommand cmd = bd.bdConn.CreateCommand();
- cmd.CommandType = CommandType.Text;
- cmd.CommandText = "select * from tb_usuario where nome_de_usuario='" + nome + "'and senha='" + senha + "'";
- cmd.ExecuteNonQuery();
- DataTable dt = new DataTable();
- MySqlDataAdapter da = new MySqlDataAdapter(cmd);
- da.Fill(dt);
- i = Convert.ToInt32(dt.Rows.Count.ToString());
- if (i == 0)
- {
- ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Falha ao logar usuário.');", true);
- }
- else
- {
- ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Usuário logado com sucesso.');", true);
- Server.Transfer("index.aspx?autor=" + nome);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement