EDMX object reference not set to instance of an object
I've used this code multiple times in my web app and for some reason this
part keeps returning the error of : Object reference not set to an
instance of an object.
string username = "John";
using (TicketsEntities dbc = new TicketsEntities())
{
var usr = from cs in dbc.Logins
where cs.FullName == username
select cs;
DataModel.Login lgn =
usr.SingleOrDefault<DataModel.Login>();
string user = lgn.Email;
lbler.Text = user;
}
There is only one entry in my db both with the name "John". I have tested
for null but it keeps giving me the error on string user = lgn.Email;
Thanks in advanced.
No comments:
Post a Comment