0
I am performing a consultation using LINQ, very simple query I am using the following method.
public void verificaAcesso( string usuario, string senha)
{
using (DbBancoContext banco = new DbBancoContext())
{
var resultadoConsulta = from u in banco.USUARIOS_PROCESSO
where
u.USUARIO == usuario
&& u.SENHA == senha
&& u.DT_CANCELAMENTO != null
select u.ID_USUARIO;
}
}
Only I’m not getting any feedback but when I check the contents of the variable resultadoConsulta
displays the following content.
{SELECT [Extent1].[ID_USUARIO] AS [ID_USUARIO]
FROM [dbo].[USUARIOS_PROCESSO] AS [Extent1]
WHERE ([Extent1].[USUARIO] = @p__linq__0) AND ([Extent1].[SENHA] = @p__linq__1) AND ([Extent1].[DT_CANCELAMENTO] IS NOT NULL)}
What am I doing wrong?
Hello. The query has not been made yet, it will be made only when using the result. To bring the result soon can add
.ToList()
at the end of the query.– Omni
@Omni I gave a +1 in your comment but it would be nice to answer the question. Just by your comment, no one could condemn me for trying to do
...select u.ID_USUARIO.ToList();
in the last row.– Caffé
@Caffé was leaving work and did not give, but it’s good that answered =) upvoted
– Omni