473,797 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Convert DataSet To Excel

I am running the following code to retrieve a DataSet:

public DataView CreateGroupSour ce()
{
string groupConnect = Session["connect"].ToString();
string groupSelect = "Select grpname from Maxusergroups where usrname = "
+ "'" + userText.Text + "'";
oda = new OleDbDataAdapte r(groupSelect, groupConnect);
DataSet ds = new DataSet();
oda.Fill(ds, "group");
DataView group = ds.Tables["group"].DefaultView;
return group;
}

When I click on a button on a web form I want to convert the information
toan excel spreadsheet.

How do I accomplish this task?

Thanks,

Dave
Nov 16 '05 #1
7 11785
Dave,

You would create a dataadapter, and then you would set the
InsertCommand, DeleteCommand and UpdateCommand to the commands that will
perform those operations. Then, feed the dataset to the Update method on
the DataAdapter, and it should work.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"kscdavefl" <ks*******@disc ussions.microso ft.com> wrote in message
news:B4******** *************** ***********@mic rosoft.com...
I am running the following code to retrieve a DataSet:

public DataView CreateGroupSour ce()
{
string groupConnect = Session["connect"].ToString();
string groupSelect = "Select grpname from Maxusergroups where usrname = "
+ "'" + userText.Text + "'";
oda = new OleDbDataAdapte r(groupSelect, groupConnect);
DataSet ds = new DataSet();
oda.Fill(ds, "group");
DataView group = ds.Tables["group"].DefaultView;
return group;
}

When I click on a button on a web form I want to convert the information
toan excel spreadsheet.

How do I accomplish this task?

Thanks,

Dave

Nov 16 '05 #2
=?Utf-8?B?a3NjZGF2ZWZ s?= <ks*******@disc ussions.microso ft.com> wrote in
news:B4******** *************** ***********@mic rosoft.com:
When I click on a button on a web form I want to convert the information
toan excel spreadsheet.


The easiest way is to export as a CSV, and then load that with Excel.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 16 '05 #3

"Chad Z. Hower aka Kudzu" <cp**@hower.org > wrote in message
news:Xn******** **********@127. 0.0.1...
=?Utf-8?B?a3NjZGF2ZWZ s?= <ks*******@disc ussions.microso ft.com> wrote in
news:B4******** *************** ***********@mic rosoft.com:
When I click on a button on a web form I want to convert the information
toan excel spreadsheet.


The easiest way is to export as a CSV, and then load that with Excel.

Excel can read xml files.

/Fredrik
Nov 16 '05 #4
"Fredrik Wahlgren" <fr************ ****@mailbox.sw ipnet.se> wrote in
news:Om******** *****@TK2MSFTNG P12.phx.gbl:
The easiest way is to export as a CSV, and then load that with Excel.

Excel can read xml files.


Even easier - if it can read the same format that the dataset produces.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 16 '05 #5
Chad,

Since Excel can read XML, and the XML produced by the DataSet is valid,
it can read them. However, you have to handle all the mappings yourself.

One catch though, you have to be using Excel XP, or 2003 and up (I'm not
sure which version support was added).

If that is not a problem for you, then I would use that.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Chad Z. Hower aka Kudzu" <cp**@hower.org > wrote in message
news:Xn******** **********@127. 0.0.1...
"Fredrik Wahlgren" <fr************ ****@mailbox.sw ipnet.se> wrote in
news:Om******** *****@TK2MSFTNG P12.phx.gbl:
The easiest way is to export as a CSV, and then load that with Excel.

Excel can read xml files.


Even easier - if it can read the same format that the dataset produces.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/

Nov 16 '05 #6

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Chad,

Since Excel can read XML, and the XML produced by the DataSet is valid, it can read them. However, you have to handle all the mappings yourself.

One catch though, you have to be using Excel XP, or 2003 and up (I'm not sure which version support was added).

If that is not a problem for you, then I would use that.


Another option is to use automation from within your C# application. Start a
new instance of Excel, make it visible, loop thru your values and pass them
one by one. You should be able to find several examples of this on the
Internet.

/Fredrik

Nov 16 '05 #7
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote
in news:#j******** ******@TK2MSFTN GP10.phx.gbl:
Since Excel can read XML, and the XML produced by the DataSet is
it can read them. However, you have to handle all the mappings
yourself.


Thats what I thought. Unless he wants to go through ODBC or Automation, the
simplest solution might be best. A CSV. :)
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 16 '05 #8

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

Similar topics

9
8900
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 this out of an XML file or Excel Template file. Next I need to convert a dataset to xml and try and transform this data into the users xml file..........i've seen a few things on this but havent had much success...
29
3711
by: Mark B | last post by:
We have an Access app (quite big) at www.orbisoft.com/download. We have had requests by potential users to have it converted to an SQL version for them since there corporate policy excludes them from buying mdb backends. Here's the (million dollar?) questions :) How long and how difficult a process would it be? Which SQL platform would we be best to develop it on?
9
13635
by: Marathoner | last post by:
I am trying to convert a dataset to an ADODB.Recordset. I create the sxl file and open it in VB.NET by using: Dim rs as ADODB.Recordset rs.Open("C:\files\xslfile.xsl") I want to do this same thing in C#. The open method in C# takes several additional parameters in addition to the xsl file: rs.Open("C:\files\xslfile.xsl", object ActiveConnection, ADODB.CursorTypeEnum, ADODB.LockTypeEnum, int Options)
4
33468
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(); excel.Application.Workbooks.Add(true); DataTable table = DATASETNAME.Tables;
1
1921
by: TaeHo Yoo | last post by:
How to convert a dataset to excel spreadsheet in windows based application?? Thanks a lot in advance. *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it!
1
2067
by: SL | last post by:
Hi - I'm fairly new to manipulating xml and I have an excel workbook and on one of the sheets is apparently a listobject... using it's xmlmap.export function I get an xml file that looks like this (truncated of course, you get the idea): <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns1:TransactionDetails xmlns:ns1="urn:Microsoft.IT.LicensePosition" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <ns1:Trans> ...
2
23028
by: Ronald S. Cook | last post by:
Hi, I need to open an Excel file from within my ASP.NET app and read data. I'm guessing the most like format in ASP.NET would be a DataTable. Regardles,, how do I get the data into my ASP.NET app from the Excel file? I have made a reference to the Excel 11.0 object library, but am not sure what code comes next. Thanks,
2
331
by: karups | last post by:
Hi when i convert Excel file to dataset using the following code, i find that, some col. such as Col1 ------ 404 403 NOT 222
3
2273
by: binny | last post by:
i use jet engine ,and oledb database but with this i get four errors which r compile time errores,plz help me to solve these errors i wrote this programe bt it is not working . using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; using System.Net.Security;
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9536
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10245
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10021
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.