我正在使用Linq进行连接多个表的select查询。请有人请检查我并告诉我语法是否错误或什么?因为,我检查了参数是否被传递,但是在查询的断点之后,它跳过foreach循环中的另一个断点并直接转到return语句。为什么会这样?
var query = from po in dbb.prescription
join pv in dbb.patient_visit on po.refid equals pv.pvid
join pod in dbb.prescription_dtls on po.psid equals pod.psid
join d in dbb.drugs on pod.dgid equals d.dgid
join a in dbb.admissions on po.refid equals a.adid
where (pv.paid == medPaid || a.paid == medPaid) &&
(po.status == "Pending") && (po.flag == null) &&
(po.TCM == false) && (po.EntBy == medUserID)
orderby pod.UpdOn descending
select new { pod.psid, pod.dgid, po.status, d.duom };
这是控制器:
[HttpPost()]
public ActionResult SetPrescOrderMyList(string medUserID, string medPaid, string medPvid, string medPsid, string medDgid, string medDoctor, string medType, float medMeasurement, float medTimes, float medDays, string medMeals, string medMorning, string medNight, string medWhenNecessary, string medHours, string medOtherInstruction)
{
vmConsultation Patient = new vmConsultation();
Patient.SetPrescriptionOrderMyList(medPaid, medPvid, medPsid, medDgid, medDoctor);
Patient.LoadPrescriptionOrderList = Patient.GetPrescriptionOrderList(medUserID, medPaid, medPvid);
return Json(Patient, JsonRequestBehavior.AllowGet);
}
我实际上是在将数据插入数据库后使用ajax从给定查询返回数据行。但它没有返回任何东西。它在查询中跳过了整个foreach循环。