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条)