Click here to Skip to main content
15,906,333 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to store an integer value with Linq in C# but I can't.
here is my code

C#
var authentication = from s in account.AccountTs
  where (s.UserName == this.user && s.PassWord == this.pass)
  select s.ID;


s.ID is an integer value of Sql table & I want to store it in an integer variable , and use it in other parts of my project , so the problem is: how to store it in a integer variable?
Help me please.
Posted
Updated 22-Jan-12 4:18am
v5

1 solution

Since authentication is a list of integers you can add this line after that LINQ statement:

C#
int id = authentication.FirstOrDefaukt();


Hope it helps.
 
Share this answer
 
Comments
Vahid sVs 22-Jan-12 14:34pm    
thanks seems it works
Amir Mahfoozi 22-Jan-12 23:46pm    
You're welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900