0

I should try this code But it didn't work properly.Please Give solution on this code

 var patientList = (from b in GBill.GetList()
                           join p in GPatient.GetList()                               
                           on b.PatientId equals p.patientid

                           select new { 
                                        patientid = p.patientid,
                                        patientName = p.patientName,
                                        address = p.address,
                                        age = p.age,
                                        BillId = b.BillId,
                                        GrandTotal = b.GrandTotal,
                                        salutation= p.salutation =="Mr."?"Male":"FeMale",
                                        VisitNo = b.VisitNo ==Convert.ToInt32( b.VisitNo >1 ? "Old" : "New")
                           }).ToList();

It show an error on Visit No;

enter image description here

adricadar
  • 9,971
  • 5
  • 33
  • 46
Ashish Aware
  • 169
  • 2
  • 15
  • 2
    Never mind LINQ to Entities, how are you expecting this to work? `Convert.ToInt32( b.VisitNo >1 ? "Old" : "New")`, when clearly, those are not numbers? – sstan Jul 12 '15 at 06:12
  • `(b.VisitNo >1 ? "Old" : "New")` has ternary operator (`?:`). here it will return `"Old"` if b.VisitNo is greater than 1. else it will be `"New"`. and you are trying to convert these strings into int. – M.kazem Akhgary Jul 12 '15 at 06:15
  • Post errors as Text, not as an image. And when you first search on that text you will find many duplicate questions already asked here. – H H Jul 12 '15 at 06:20
  • thank you guys.. I remove this convert.ToInt32 and try this VisitNo = b.VisitNo == 1 ? "New" : "Old" and its work – Ashish Aware Jul 12 '15 at 06:23

0 Answers0