ASP.Net - 出口SQL查询结果到Excel [英] ASP.Net - Export SQL query result to Excel

查看:81
本文介绍了ASP.Net - 出口SQL查询结果到Excel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我期待有导出到Excel中一个SQL查询,格式化成模板的结果。

I am looking to have the result of a SQL query exported to Excel, formatted into a template.

基本上对数据行用户点击,查询执行该特定参数和向用户给出保存到Excel文件的选项。

Basically the user clicks on the datarow, the query executes for that particular parameter and the the user is given the option to save to Excel file.


  1. 如何插入此数据到一个Excel模板。

  2. 我可以绕过保存Excel文件的位置,这样用户只提示,因此,如果不保存文件取消?

干杯

比尔

推荐答案

我会用正常的解决方案来获取数据的SQL Server和到Excel(如行和放大器;列),但将返回的数据在不同的工作表比你的模板。

I would use the normal solutions to get the data out of sql server and into excel (as rows & columns), but put the returned data in a different worksheet than your template.

<一个href=\"http://blogs.office.com/b/microsoft-excel/archive/2010/06/07/running-a-sql-stored-procedure-from-excel-no-vba.aspx\" rel=\"nofollow\">http://blogs.office.com/b/microsoft-excel/archive/2010/06/07/running-a-sql-stored-procedure-from-excel-no-vba.aspx

的http:// codebyjoshua.blogspot.com.au / 2012/01 / GET数据 - 从-SQL服务器stored.html

一旦你的数据在Excel中,在工作表模板,只需要使用指向每个数据项('= Sheet2的!A6')的数据表。

Once your data is in excel, in the template worksheet, just use links to the data sheet for each data item ('=Sheet2!A6').



mcalex

hth
mcalex

这篇关于ASP.Net - 出口SQL查询结果到Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆