1
During my computer technical course, in the Programming module, I did a project with Windows Form! This project is linked to a database created by myself in SQL Server!
It would be a "software" for medical clinic (all fictitious), at first I have a screen where who accesses will put: User, Password and Performance Sector! There are only three sectors that can access the system: Doctors, Administrator and Receptionist! Since each one will have different access, ie the Adm is who can access the entire system,ja doctors and receptionist will be denied access to some areas!
I made a DAL and also made the button codes that will allow access to the system! Only he gives me an error message:
The problem is I can’t find the mistake! Follow below image of the code:
Unfortunately I’ll have to put the code in anyway, because I can’t get a print of the entire code,!
**
}
dr.Close();
return seto.SetorRestricao;
}
public string logasenha(string usuarioRestricao,string senhaRestricao,string setoAtu)
{
SqlConnection NanoTec = new SqlConnection(Conexao.ObtemConexao());
NanoTec.Open();
SqlCommand Comando = new SqlCommand("select * from Restricao where NomeUsuario = '" + usuarioRestricao + "' , SenhadeAcesso = '" + senhaRestricao + "' AND SetorAtuacao = '" + setoAtu + "'" , NanoTec);
SqlDataReader dr = Comando.ExecuteReader();
RestricaoDAL senha = new RestricaoDAL();
while (dr.Read())
{
senha.SenhaRestricao = dr["SenhaRestricao"].ToString();
}
return senha.SenhaRestricao;
}
}
}
**
Anyone to help? After this help I will need another, but I will not post it until I find my mistake clear!
Thank you Carol!
Exchange the comma in consultation for an AND
– Denis Rudnei de Souza
Assim: SqlCommand Comando = new SqlCommand("select * from Restricao where NomeUsuario = '" + usuarioRestricao + "' AND SenhadeAcesso = '" + senhaRestricao + "' AND SetorAtuacao = '" + setoAtu + "'" , NanoTec);
– Denis Rudnei de Souza
Denis Rudnei, thank you so much for your help! I tidied up the code and gave it right!
– Carol M
http://meta.pt.stackoverflow.com/a/5485/55024
– TotallyUncool