Error in list of function arguments: '=' not recognized. unable to parse query text. - C# Table Adapter

六月ゝ 毕业季﹏ 提交于 2019-12-25 08:15:18

问题


This is a follow-up of a previous requestion. Here Is the link

It Was about selecting Value from the same field twice with different conditions and display results in separate fields

And Used Following Code In table Adapter - IIF

SELECT AttendanceReg.StudentID,AttendanceReg.Studname, AttendanceReg.StudSex,
AttendanceReg.StudCourse,
SUM(IIf( AttendanceReg.AttendStatus = 'Present', 1,0)) AS TotalPresent,
SUM(IIf( AttendanceReg.AttendStatus = 'Absent', 1,0)) AS TotalAbsent, 
DatePart('m', AttendanceReg.DateOfAttendance) AS MYMONTH

FROM (AttendanceReg
    INNER JOIN LocalTable ON
    AttendanceReg.StudCourse = LocalTable.AttendCourse 
    AND 
    DatePart('m', AttendanceReg.DateOfAttendance) = LocalTable.AttentMonth)

GROUP BY AttendanceReg.StudentID, AttendanceReg.Studname,
    AttendanceReg.StudSex, AttendanceReg.StudCourse,
    DatePart('m', AttendanceReg.DateOfAttendance)

ORDER BY DatePart('m', AttendanceReg.DateOfAttendance) DESC

Also, I Have Tried by Replacing "IIF" With "Switch" Like Below

SUM(SWITCH(EmpAttendance.AttendStatus = 'Present',1,
EmpAttendance.AttendStatus = 'Absent', 0)) AS TotalPresent,
SUM(SWITCH(EmpAttendance.AttendStatus = 'Absent',1,
EmpAttendance.AttendStatus = 'Present', 0)) AS TotalAbsent,

Both the Querys Are Working Prefectly While Testing. But this what happening While trying to create table adapter :(

- how to solve this issue?

  • Can use any other Query instead of this?

来源:https://stackoverflow.com/questions/41888400/error-in-list-of-function-arguments-not-recognized-unable-to-parse-query-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!