Reputation: 1049
I am working on a WCF, Entity Framework, Self track solution.
I have a problem with the ESQL.
string cmd = "Select h.achAccId, p.patDOBirth, p.patGender from PatientEntities.AccBases as a, PatientEntities.AccHosps as h, PatientEntities.Patients as p Where h.achAccID = 57348 and p.patPatId = a.acbPatId and h.achAccId = a.acbAccId";
ObjectQuery<dbdatarecord>queryResult = null;
using (PatientEntities db = new PatientEntities()) PatientEntities is ObjectContext
{
`queryResult = db.CreateQuery<dbdatarecord>(cmd);`
}
if ((queryResult != null) && (queryResult.Count() > 0))
{
`...`
}
queryResult.Count()
causes an error : "'achAccID' is not a member of type 'PatientModel.AccHosp' in the currently loaded schemas"
I found under PatientModel.edmx
file, under <EntityType Name="AccHosp">
there is <property Name="achAccID" Nullable="false" Type="int">
So what is the real problem?
Upvotes: 2
Views: 320
Reputation: 1049
The ESQL has no problem. The datacontext need refreshing. ie. db.Refresh(RefreshMode.StoreWins, db.AccHosps);
Upvotes: 0