|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dataset to excelHi 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 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(); Show quote "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 > > > I've detailed a variety of technique for Excel export here:
http://SteveOrr.net/articles/ExcelExport.aspx Show quote "Reggie" <NoSpam_chief123101@NoSpam_yahoo.com> wrote in message news:GgHtg.339$OI5.218@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 > 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. -- Show quote****************** Reggie "Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message news:%23BFd9a2pGHA.524@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.com> wrote in message > news:GgHtg.339$OI5.218@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 >> > > |
|||||||||||||||||||||||