且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C#中将Sql Server数据导出到Excel文件

更新时间:2023-02-04 16:03:01

我将使用某种OR-Mapper从SQL中读取数据,例如

I would use some kind of OR-Mapper to read data from SQL such as

  • NHibernate
  • 实体框架
  • Linq 2 SQL

要向Excel中写入数据,您几乎不能通过引用Excel程序集将其绑定到任何Excel版本.更加干净和美观的方法是使用Office Open XML SDK http://www.microsoft.com/download/zh-CN/details.aspx?id=5124

For writing data to Excel you could bind hardly to any Excel Version by referencing the Excel Assemblies. The cleaner and more beautiful way is to use Open XML SDK for Office http://www.microsoft.com/download/en/details.aspx?id=5124