asp.net core - Display data in an RDLC report using a left outer join in a LINQ query - Stack Overflow

I have found it challenging to display a single staff member's data in an RDLC report when using a

I have found it challenging to display a single staff member's data in an RDLC report when using a left outer join in a LINQ query. The issue arises from using two tables: the Staff table and the Loan table. Some staff members collect loans while others do not. Consequently, when I try to display the data for a single staff member in the RDLC report, it only shows those staff members who are present in both the Staff and Loan tables. If a staff member has not collected any loans, an error occurs stating that a nullable object must have a value. The query contains two conditions: the staff ID and the VoucherDate, which are present in both the Staff and Loan tables.

var query = from p in _context.Stafftable
         join q in _context.Loantable
         on new { questionId = p.StaffId, pickerId = p.VoucherDate }
         equals new { questionId = q.OStaffID, pickerId = q.OVoucherDate } into Handles
         from sub in Handles.DefaultIfEmpty()
         where p.StaffId == model.UserName && p.VoucherDate == model.Monthtype + " " + model.Yeartype
         select new
         {
             p.StaffId,
             p.PSN,
             p.SurName,
             p.OtherName,
             p.Rank,
             p.MDA,
             sub.ODeductType,
             sub.OStartDate,
             sub.OEndDate,
             sub.OPrincipalAmt,
             sub.OTotalInstll,
             sub.OInstallPaid,
             sub.ODeductAmt,
             sub.OAllowAmt
         };

var slip = query.ToList();

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744908654a4600411.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信