【问题标题】:Is there a way to split a list in the following format : 'string1', 'string2', 'string3',有没有办法以以下格式拆分列表:'string1','string2','string3',
【发布时间】:2020-01-15 06:55:36
【问题描述】:

我需要对现有的 XtraReport 执行过滤器,并且我只想查看一些我有其 ID 的特定记录。

当我执行以下代码时,它已成功应用。

XtraReportOrder report = new XtraReportOrder();
report.FilterString = "orderId IN ('11092', '11093')";
report.ShowPreviewDialog();

我想这样用,

report.FilterString = "orderId IN ("+MyList.ToConvertSthConvinient+")";

【问题讨论】:

标签: c# sql split filtering where-in


【解决方案1】:

您可以结合使用String.Join、LINQ 和字符串插值功能:

report.FilterString = $"orderId IN ({String.Join(", ", MyList.Select(id => $"'{id}'"))})";

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-09-09
    • 1970-01-01
    • 2017-10-17
    • 1970-01-01
    • 1970-01-01
    • 2010-11-15
    • 1970-01-01
    • 2022-01-05
    相关资源
    最近更新 更多