Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
|
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 17th, 2004, 01:44 AM
Authorized User
 
Join Date: Oct 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to export data to Excel from SqlDataReader

hi,

i want to export data to excel file/format. i used StreamWriter class as follows:

System.IO.FileInfo info = new System.IO.FileInfo("c:\data.xls");
System.IO.StreamWriter writer = info.AppendText();

now whatever i write to file using writer.Write()/ writer.WriteLine(), is not individually placed in excel cell, but
are placed as a whole sentence.

how can i get my individual items to individual excell cell?
please help.

Arif.

Note: if i carete file with .cs extension then i achieve my goal but i want to understand the real phenomenon of
data export to .xls file.


 
Old October 17th, 2004, 11:32 PM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Check out whether this helps you
http://support.microsoft.com/default...b;en-us;317719

 
Old October 19th, 2004, 01:53 AM
Authorized User
 
Join Date: Oct 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,
the link
http://support.microsoft.com/default...b;en-us;317719
is very good but it is for ASP.NET. i m working in C# and the statement

Set oXL = CreateObject("Excel.Application")

doesn't work in C#.

How can i do this in C#?
Please help.

Arif.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Excel (Data only) nikks9 ASP.NET 1.0 and 1.1 Professional 3 February 9th, 2011 05:01 AM
Export Data to Excel seananderson Access 2 January 16th, 2007 12:30 PM
Export Data to Excel msbsam ASP.NET 2.0 Basics 0 November 8th, 2006 02:09 AM
How to export data into Excel lily611 General .NET 8 January 11th, 2006 10:02 PM
export data to Excel?? amy_mgfe Excel VBA 0 January 15th, 2005 10:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.