這是我的字符串sql查詢,但我無法將它轉換爲linq,因爲它包含基於where子句的任何幫助,我們將不勝感激。linq中的where子句中的sql case語句
if (StrClientID.Equals("008"))
objdbhims.Query += " and ((case when t.external_org is null then d.clientid='008' end) or t.external_org in ('008','-1'))";
else if (StrClientID.Equals("006"))
objdbhims.Query += " and (t.external_org<>'008' or (case when t.external_org is null then d.clientid='" + StrClientID + "' end))";
else
objdbhims.Query += " and d.clientid='"+StrClientID+"'";
可以使用三元運算符'? :在linq –
@RaphaëlAlthaus案例語句替換是否如果其他但在三元運算符當我做? 和我不把其他部分,它給出了語法錯誤,我不想要其他部分,如何做到這一點/ –
以及你可以在第二部分只是把類似'm => true' ... –