473,383 Members | 1,984 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Dataset to excel

Hi and TIA! I have a recordset retrieved into a datgrid in my web app, from
an SQL database that I want to save as an excel formatted file. I would
like the user to click a button, get a prompt to save/name the file. Is
this possible and if so where can I find information on accomplishing this
task. Any advice is appreciated. Using (.Net 1.1 / VS2003 / SQL Server
2000 / WinXP Pro). I posted to several groups cause not sure the best place
to ask the question.
Thanks for your time.
--

******************
Reggie
Jul 14 '06 #1
3 1219
try this code as i used it it worked perfect with c#
string sFilename="myexcel";
Response.ContentType = "application/vnd.ms-excel";
Response.AppendHeader("Content-Disposition", "attachment;filename=" +
sFilename);
Response.Charset = "";
// Turn off the view state.
this.EnableViewState = false;
System.IO.StringWriter tw=new StringWriter();
HtmlTextWriter hs=new HtmlTextWriter(tw);
this.MyGrid.RenderControl(hs);
Response.Write(tw.ToString());
Response.End();
"Reggie" wrote:
Hi and TIA! I have a recordset retrieved into a datgrid in my web app, from
an SQL database that I want to save as an excel formatted file. I would
like the user to click a button, get a prompt to save/name the file. Is
this possible and if so where can I find information on accomplishing this
task. Any advice is appreciated. Using (.Net 1.1 / VS2003 / SQL Server
2000 / WinXP Pro). I posted to several groups cause not sure the best place
to ask the question.
Thanks for your time.
--

******************
Reggie
Jul 14 '06 #2
I've detailed a variety of technique for Excel export here:
http://SteveOrr.net/articles/ExcelExport.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Reggie" <NoSpam_chief123101@NoSpam_yahoo.comwrote in message
news:Gg***************@fe07.lga...
Hi and TIA! I have a recordset retrieved into a datgrid in my web app,
from an SQL database that I want to save as an excel formatted file. I
would like the user to click a button, get a prompt to save/name the file.
Is this possible and if so where can I find information on accomplishing
this task. Any advice is appreciated. Using (.Net 1.1 / VS2003 / SQL
Server 2000 / WinXP Pro). I posted to several groups cause not sure the
best place to ask the question.
Thanks for your time.
--

******************
Reggie

Jul 14 '06 #3
Steve, Exactly what I've been trying to accomplish. I'm a little new at
ASP.Net and the .Net Framework stuff, but I'm getting there. Thanks again
for you time and advice. Take care.

--

******************
Reggie
"Steve C. Orr [MVP, MCSD]" <St***@Orr.netwrote in message
news:%2***************@TK2MSFTNGP05.phx.gbl...
I've detailed a variety of technique for Excel export here:
http://SteveOrr.net/articles/ExcelExport.aspx

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Reggie" <NoSpam_chief123101@NoSpam_yahoo.comwrote in message
news:Gg***************@fe07.lga...
>Hi and TIA! I have a recordset retrieved into a datgrid in my web app,
from an SQL database that I want to save as an excel formatted file. I
would like the user to click a button, get a prompt to save/name the
file. Is this possible and if so where can I find information on
accomplishing this task. Any advice is appreciated. Using (.Net 1.1 /
VS2003 / SQL Server 2000 / WinXP Pro). I posted to several groups cause
not sure the best place to ask the question.
Thanks for your time.
--

******************
Reggie


Jul 15 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Paul | last post by:
Hi all Arggghhh........... The problem.....I want the user to be able to create an excel document and name particular cells in the document where they want the data to be placed and then save...
2
by: Eric | last post by:
Hi, I am making a flash card type program for the PocketPC. I am using a dataset to contain the cards, all of that works great. I thought I would just import the XML into word or excel,...
3
by: JacksonYin | last post by:
1. I can fill data from Excel to DataSet like this: OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=../../Book1.xls;Extended Properties=Excel...
4
by: Hans [DiaGraphIT] | last post by:
Hi! I want to export a dataset to an excel file. I found following code on the net... ( http://www.codeproject.com/csharp/Export.asp ) Excel.ApplicationClass excel = new ApplicationClass();...
3
by: Schultz | last post by:
I would like to know if it is possible to import data from MS Excel 2000 to a dataset using asp.net. The excel file would need to be uploaded to the server from a web page first, before the loaded...
4
by: washoetech | last post by:
Hello, I am working on a project where I need to be able to grab the data from an Excel spreadsheet and create a new table in my database based on the columns in the spreadsheet. After the...
7
by: postings | last post by:
Hi - can you help please? Please review the following straightforward code which works fine with ordinary XML files. ---------------------------------------------------------------- Dim...
4
by: Phoebe. | last post by:
Hi, Good Day! Reading 1 excel file into a dataset is fine. How can I read multiple excel with the same data structure into 1 dataset? How can I append those data? Can someone help? Thanks in...
1
by: Ramakrishnan Nagarajan | last post by:
Hi, I am converting Excel data into a Dataset in C#. There are around 24 columns in the Excel Sheet. First I tried to insert one row with correct values in the Excel sheet. i.e. for text columns...
3
by: Sachin Salgarkar | last post by:
I have a DataSet that I need to export to Excel. The dataset has multiple tables. I need a way to export the complete dataset to a single Excel Workbook with sheets for each table in the dataset....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.