views:

99

answers:

2

how to return a dataset from linq in .net 3.5?

I have seen in some sites that CopyToDataTable method is used but I am not able to use that methos as I cannot find System.data.datatableextensions reference in the ref list. Please help me out.

Thanks and regards, veena

A: 

Copied Directly from here. Try to search before asking

// Fill the DataSet.
DataSet ds = new DataSet();
 FillDataSet(ds);

DataTable orders = ds.Tables["SalesOrderHeader"];

IEnumerable<DataRow> query =
    from order in orders.AsEnumerable()
    where order.Field<DateTime>("OrderDate") > new DateTime(2001, 8, 1)
    select order;

DataTable boundTable = query.CopyToDataTable<DataRow>();

bindingSource.DataSource = boundTable;
Shantanu Gupta
A: 

Which also goes for VB.NET, only you have to declare query variable as IEnumerable(Of DataRow) instead putting only Dim keyword.

judah