0

我需要一个由 LINQ to SQL 结果制作的临时 DataTable 或 DataView。但我无法根据 VB.Net 2010 中的 L2S 方法准备它们。是否可以不使用循环?

还有一个基本问题!L2S结果的结构是什么?我在想它一定是一个数据表!

4

1 回答 1

0

使用 Linq 到数据集。http://msdn.microsoft.com/en-us/library/bb386921.aspx

' Query the SalesOrderHeader table for orders placed 
'  after August 8, 2001.

Dim query = _
From order In orders.AsEnumerable() _
Where order.Field(Of DateTime)("OrderDate") > New DateTime(2001, 8, 1) _
Select order

' Create a table from the query.
Dim boundTable As DataTable = query.CopyToDataTable()

希望,它应该工作。

于 2012-09-09T09:25:44.770 回答