I have the following simple LINQ to SQL statement:
string strUserID = Eval("whoInsert").ToString();
insLusHmoobDataContext userDataContext = new insLusHmoobDataContext();
var userName = from usr in userDataContext.Users
where usr.UserId.Equals(strUserID)
select usr.UserName;
return userName.ToString();
Instead of showing me the UserName from the aspnet_Users table, it showed me the SQL select statement. Any idea?
That’s assuming there’s going to be a single user for that ID, else you could use
FirstOrDefault().