How to export datatable to excel using c# in ASP.NET?

Closed
Vikram_27 Posts 3 Registration date Monday November 12, 2018 Status Member Last seen November 15, 2018 - Nov 14, 2018 at 09:45 AM
 Blocked Profile - Nov 15, 2018 at 05:15 PM
Hello,

I would like to know how can I easily export datatable to excel file using C#?
I am currently using GridView

Thanks
Related:

1 response

Blocked Profile
Nov 14, 2018 at 04:17 PM
"easily"

Not going to happen, nor are we going to code a turn key solution for this. If you had code, we might help.

It really doesn't get any easier than IMPORT EXTERNAL DATA, and place your ODBC credentials from the live DB. NO coding needed!


1
Vikram_27 Posts 3 Registration date Monday November 12, 2018 Status Member Last seen November 15, 2018
Updated on Nov 15, 2018 at 02:30 AM
NO Coding needed?? how sir?
I need it in C#, so would need coding I think, I am not sure how it is possible, please explain?
0
Blocked Profile
Nov 15, 2018 at 05:15 PM
Start a new sheet. Click on Data. Click on Get Data from From Database. Put in your credentials for the Data base.

See image below.


Do you know the difference between proprietary and a standard? Excel is proprietary.

DO you know how to properly format the data so EXCEl can read it?

I do, it is called a standard format, which would be (in this case) a CSV file.


IF you cannot code your own C# CSV file, then this is kind of like me playing chess with a pigeon.

The pigeon will crap all over the game board, and strut off like it won!

Get it?

No playing chess with a pigeon!
0