Filling a DataSet or DataTable from a LINQ query result set

后端 未结 7 774
一个人的身影
一个人的身影 2020-12-01 02:38

How do you expose a LINQ query as an ASMX web service? Usually, from the business tier, I can return a typed DataSet or DataTable which can be seri

7条回答
  •  伪装坚强ぢ
    2020-12-01 03:03

    As mentioned in the question, IEnumerable has a CopyToDataTable method:

    IEnumerable query =
        from order in orders.AsEnumerable()
        where order.Field("OrderDate") > new DateTime(2001, 8, 1)
        select order;
    
    // Create a table from the query.
    DataTable boundTable = query.CopyToDataTable();
    

    Why won't that work for you?

提交回复
热议问题