I think it's a somewhat conceptual question on the subject, but come on:
I have an example method that validates a user by checking whether it exists in the database, like this:
public bool ValidaCampos(string Nome)
{
string str = "select count(*) FROM USER where racf='" + Nome "'";
var cont = cD.ExecutaScalar(str);
if(Cont>0)
{ return true;}
else
{ return false;}
}
Although it is a simple method, I would like to understand what would be the leanest and most correct way to test the operation with the database.