public string LoginUser(string email, string password)
{
string query = @"SELECT VALUE tblUser FROM MyEntities.tblUser AS tblUser WHERE tblUser.email = @email AND tblUser.password = @password";
ObjectParameter[] parameters = new ObjectParameter[2];
parameters[0] = new ObjectParameter("email", email);
parameters[1] = new ObjectParameter("password", password);
using (var context = new MyEntities())
{
ObjectQuery<string> results = context.CreateQuery<string>(query, parameters);
foreach (string result in results)
{
if (result != null)
{
return result;
}
}
}
return null;
}
i did double check on my code and the entity query itself got no problem but i don’t know why it will giving me the message as titled and could not load the data. This is WCF part and calling data from SQL Azure. By using Phone.Can anyone please give me a hint on how to solve it while i spent few hours still couldn’t overcome this. Thank you.
I suspect that, your model does not have an entity named as tblUser. The database table name and entity name may not be the same. For instance; if you are using model first approach with default settings; table names in the database are generated with a “set” or an “s” suffix.