【问题标题】:How to convert IEnumerable<table> to xml or dataset如何将 IEnumerable<table> 转换为 xml 或数据集
【发布时间】:2011-01-06 21:38:02
【问题描述】:

这是代码:

IEnumerable<table> results = db_dane.ExecuteQuery<table>(query);
  • table - 是一个数据库表,
  • query - sql 查询(例如:select * from table),
  • db_dane - linq 数据上下文。

如何将此查询的结果转换为 xml 或数据集?

【问题讨论】:

    标签: xml linq dataset ienumerable


    【解决方案1】:

    我最好的想法是通过 ToList() 将其转换为 List,然后循环将其转换为数据表。

    http://ayende.com/Blog/archive/2007/05/09/Converting-an-object-collection-to-a-DataSet.aspx

    凌乱,但应该工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-01-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多