asp.net mvc 4 - How to get a single value from db using Fluent Hibernate -


i'm new fluent hibernate , i'm stuck problem want email id of user using user name means want implement following code using fluent hibernate

select emailid table username="user" 

i tried following code not give me want

public string forgetpassword(string user) {     var factory = createsessionfactory();     using (var session = factory.opensession())     {         var getemail = session.query<clsaccountbl>()             select(u => u.email).where(u => u.user == user).tostring();            return getmail;      }  } 

please me solve this

instead of .tostring() use firstordefault(). linq not return "single" element.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -