Hi EveryOne
I would like to download the SQL server databse to excel file using ASP.Net
I need to download the one table to excel file. If anyone knows please help me.
With Regards
Nibu Abraham
hi
i found this link
http://www.theserverside.net/discussions/thread.tss?thread_id=29385
give a try
|||
Hi Nibu
Create a stored procedure to display the required columns from the give table. Grant execute permission to this stored procedure to the role that your ASP.NET account is assigned to. In your datalayer, run the stored procedure to output a dataset. Add a gridview control (or datagrid if still at ASP.NET 1.1) to an ASPX form.
Set the datasource for the control to the dataset produced by the read function in your data layer, call databind and the data will be displayed.
There is a simple modifier to make the displayed page OLE load Excel - I will find out the how of this at the weekend.
HTH
|||
You need to add the following to your Page_Load
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
You will need to turn off the sort option on the grid and any other hyperlinks on the form.
HTH
sql
No comments:
Post a Comment