简体   繁体   中英

How to Export database data table to Excel Sheet in asp.net?

I have a requirement that , i have a table of 400 columns.

Here i need to Export this table to Excel sheet.

And i need to upload to Open Office Sheet. I do not have MS-office.

This is in ASP.NET and C#.NET

I am new to this concept.

So please help me to solve this.

And friends there is a problem , i have 400 columns , which is not possible to insert into Open Office Excel , i need to insert other columns into new sheet

Thank You All!!!!

看看这个

Alternatively you can look at using OleDB to do this

Reading and Writing Excel Spreadsheets Using ADO.NET

I've used this method a number of times and found it to be quick and effective.

3rd Alternative, if it doesn't have to be a true xls/xlsx file and you want lots of control over what the final output looks like, try Microsoft's Spreadsheet XML.

XML Spreadsheet Reference

Again, I've used this method to great effect

You can read from one source and update to another using DataSet, with 2 distinct tOleDb connections.

Here's some code that does that.

CopyData-SqlToExcel-TwoOledbConnections.cs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM