【问题标题】:Map column names from a datatable to another datatable in C#将数据表中的列名映射到 C# 中的另一个数据表
【发布时间】:2020-09-18 11:36:23
【问题描述】:

我想从另一个数据表映射一个数据表的列名。请参考以下示例。我有 2 个从数据库返回的数据表。

请参阅以上 2 个表格。第一个表包含数据,第二个数据表包含列映射。 我想将列名从第二个表映射到第一个表。最终结果应该如下。

【问题讨论】:

标签: c#


【解决方案1】:

您可以动态生成 SQL 语句并最终得到:

Select column1 as city, column2 as country,
column3 as population, column4 as tourist
from whatever_table

【讨论】:

    猜你喜欢
    • 2017-11-09
    • 1970-01-01
    • 1970-01-01
    • 2019-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多