I thought IQueryable<T>
was derrived from IEnumerable<T>
, so why can't I access the results of my query like a collection of records?
public bool DoLogIn(System.String strUserName, System.String strPassword)
{
if (this.IsLoggedIn)
return false;
ASRDBDataContext ASRData = new ASRDBDataContext();
IQueryable<user> CurrUser =
from usr in ASRData.users
where usr.userName == strUserName
where usr.password == strPassword
select usr;
if (CurrUser.Count() != 1)
return false;
this.CurrUserID = CurrUser[0].userID; // Error
return true;
}
The error returned is: "Cannot apply indexing with [] to an expression of type 'System.Linq.IQueryable<user>
'"