Quantcast
Channel: How to Export datatable or datagridview contents to Excel without Interop
Viewing all articles
Browse latest Browse all 15

How to Export datatable or datagridview contents to Excel without Interop

$
0
0

In a web forms application, I am populating a datagridview using datatable.

I need help to export this data from datagridview (or datatable) without using Excel interop method. 

Can someone please help with this. Thanks.

SqlDataAdapter adapter = new SqlDataAdapter("SELECT * FROM myTable", sqlConn);
DataTable datatable = new DataTable();
adapter.Fill(datatable);
datagridview1.Datasource = datatable;

Viewing all articles
Browse latest Browse all 15

Latest Images

Trending Articles





Latest Images