I have a problem, I have a login screen and I need to check it with a query Sql
.
Get something done, but it does not check and goes straight through.
private void btn_Entrar_Click(object sender, EventArgs e)
{
SqlConnection conexao = new SqlConnection();
conexao.ConnectionString = Properties.Settings.Default.cs1;
try
{
conexao.Open();
SqlCommand obj = new SqlCommand();
obj.CommandText = "Select * FROM TB_LOGIN WHERE Usuario =@Usuario And Senha=@Senha";
obj.Parameters.Add("@Usuario", SqlDbType.VarChar).Value = Txt_Nome.Text;
obj.Parameters.Add("@Senha", SqlDbType.VarChar).Value = Txt_Senha.Text;
obj.CommandType = CommandType.Text;
obj.Connection = conexao;
obj.ExecuteNonQuery();
conexao.Close();
}
catch
{
MessageBox.Show("Falha ");
conexao.Close();
}