How To Convert List <DataTable> Into DataSet

Introduction 

I'm trying to fetch employee details from the database using a stored procedure.

Once data is retrieved, trying to segregate data based on department level using LinQ code as below.

Dim resultDataTable As List(Of datatable) = dt.AsEnumerable().GroupBy(Function(x) x.Field(Of String)("Department")).[Select](Function(grp) grp.CopyToDataTable()).ToList()

By the above line of code, two lists are getting generated & the same needs to be exported to excel as two spreadsheets in one excel file.

  1. How to export list<datatable> to excel with multiple spreadsheets
  2. How to bind list<datatable> to gridview

Kindly assist with this.


Similar Articles