hus*_*snu 3 c# sql split filtering where-in
我需要对现有的XtraReport执行过滤器,并且只想查看具有其ID的某些特定记录。
当我执行此代码时,它将成功应用。
XtraReportOrder report = new XtraReportOrder();
report.FilterString = "orderId IN ('11092', '11093')";
report.ShowPreviewDialog();
Run Code Online (Sandbox Code Playgroud)
我想用这样的东西
report.FilterString = "orderId IN ("+MyList.ToConvertSthConvinient+")";
Run Code Online (Sandbox Code Playgroud)
您可以结合使用String.JoinLINQ和字符串插值功能:
report.FilterString = $"orderId IN ({String.Join(", ", MyList.Select(id => $"'{id}'"))})";
Run Code Online (Sandbox Code Playgroud)