-1
Guys I have access authorization login, only when I execute the authorization it deletes the previous one and stays the current one. For example: I have the user login (basic), to execute an action the user needs to be released by a login (Administrator). I am doing this code below. But when I run it , it is logged in as Login (Administrator) and no longer as login (basic).
if (LoginUsuárioCache.Cargo == FuncionárioCargo.Administrador)
{
ConexaoLeituraBanco conexaoLeituraBanco = new ConexaoLeituraBanco();
using (var connection = conexaoLeituraBanco.GetConnection())
{
connection.Open();
using (MySqlCommand commad = new MySqlCommand())
{
commad.Connection = connection;
commad.CommandText = "UPDATE pdv_historico SET sangria = sangria";
commad.Parameters.AddWithValue("sangria", sangria);
commad.CommandType = CommandType.Text;
MySqlDataReader reader = commad.ExecuteReader();
connection.Close();
this.Close();
}
}
}
The update part is correct. I already put the WHERE. It does the UPDATE values correctly. The problem is that it comes back logged in as Administrator and not as it was before. As login (basic).
– Teles
How’s the rest of your code?
– Gabriel Braga
UPDATE pdv_historico SET sangria = @ sangria WHERE usuario = '" + txtNome.Text + "' ORDER BY idpdv_historico DESC LIMIT 1"; Then it makes the change in mysql where the basic user name is equal to (txtNome.text). Then close the connection, close the login tele and return to the initial FORM.
– Teles