我正试图在LINQ中编写一个搜索查询。以下是哪里的条件。LINQ搜索查询不起作用
where (!string.IsNullOrEmpty(nameWithInitials)
&& tb.NameWithInitials.Contains(nameWithInitials))
&& (!string.IsNullOrEmpty(studentRegNo)
&& tbSR.StudentRegistrationNo.Contains(studentRegNo))
&& (!string.IsNullOrEmpty(NIC) && tb.NIC.Contains(NIC))
&& (!string.IsNullOrEmpty(fullName) && tbi.Name.Contains(fullName))
如果我传递一个参数,它不返回任何值。例如,如果我将'Chamara'作为全名传递,它不会返回任何结果,但如果我传递一次所有参数,则会返回匹配的记录。
我需要当我通过几个参数动态
什么应该是结果,如果你不通过任何东西? (我的意思是,所有字符串都是空或空)? – Steve