473,834 Members | 2,362 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exporting Data from DataSet to text file or xls file

308 Contributor
Hi all,

Is there any way by which I can export the data from the dataset table to the text file or xls file ?

Currently I implemented this by itterating through each row of the table and writting the data to file.I want to avoid iteration.It occured to me bcoz skipping iteration will improve the performance.

Please Help..

Thanks!
Sep 25 '09 #1
13 4527
ssnaik84
149 New Member
Do you want to save .xls file on disk or just to create-n-send through browser on-the-fly?
in second case, you just need to set page header...

Expand|Select|Wrap|Line Numbers
  1. HttpContext.Current.Response.ContentType = "text/csv";
  2. HttpContext.Current.Response.AddHeader("Pragma", "public");
Sep 25 '09 #2
madankarmukta
308 Contributor
@ssnaik84
Hi ,

Thanks for your reply.

But I want to export/copy data from dataset table to the file.The File I want to save it on local disk.

Please provide input.

Thanks!
Sep 25 '09 #3
Plater
7,872 Recognized Expert Expert
Have you looked at the .WriteXML() function?
Sep 25 '09 #4
madankarmukta
308 Contributor
@Plater
Hi,

Thanks for the reply.

per my understanding .. writeXml function is used to get the xml equivalent of the table's data which is not my goal. Suppose the dataset table contains the data as -

=============== =
Column1 Column2
=============== =
Value11 Value22
--------------------------------
Value12 Value21
--------------------------------
I want it should get write to the text file as it is and not it's xml format.

If I m wrong pls. correct me.

Thanks again!
Sep 27 '09 #5
Plater
7,872 Recognized Expert Expert
Well an XML file would be able to be read by Excel.
But for your request, you would need to format the data in a text string yourself. Looping through the data.
You could check to see if someone has already created a function for doing that?
Sep 28 '09 #6
madankarmukta
308 Contributor
@Plater
Hi,

Thanks for the reply.

As I stated earlier I implemented the same way as you described here.But to avoid the "looping through data" I want to have some direct way by which the data can directly exported to text file.

Though the code was working smoothly previously, it may lead to degrade the peformance;beca use my table will now hold the records at the count of a lacs or two.

Please provide inputs if you have any.

Thanks again!
Sep 29 '09 #7
tabla
8 New Member
Hi,
Have u tried it with UTL package.check the same it is very fast.

Tabla
Sep 29 '09 #8
madankarmukta
308 Contributor
@tabla
Could you pls. elaborate more on what you want to say ..?

Thanks!
Sep 29 '09 #9
tabla
8 New Member
Hi,
There is one package UTL_FILE in oracle which read/write/append the data into existing or New .txt or .xls or .csv file.

First have all the data which u want to write in file into cursor.
Then open a file in UTL directory (take help of dba to know the path).
Using UTL_FLIE.PUT_LI NE procedure you can write a data in to FILE.
After reading all records from cursor close the open file.

Tabla
Sep 29 '09 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
8015
by: Chris | last post by:
Could someone please provide me an effective means of exporting data from a data set (or data grid) to Excel?
2
1932
by: Mike P | last post by:
How do you go about exporting data in excel to a C# dataset? Any help would be really appreciated. Cheers, Mike
2
1065
by: brian | last post by:
I am using vb.net and sql2000. What is the best way using vb.net to export data to text file. I can retrieve it through a dataset or reader. There are a lot of columns. I perfer not to use the dts designer in sql2000. Does anyone have any white papers or other resources for me to take a look at? Thanks
1
2469
by: Luis Esteban Valencia | last post by:
Hello Everyone, Iam an intermediate ASP.Net programmer and iam facing a challenging task. I have a table in MS-SQL server database called 'Members'. The table has following fields... mem_id integer primary key lastname nvarchar(30) firstname nvarchar(30)
2
2417
by: bienwell | last post by:
Hi, I have a question about exporting data from datagrid control into Excel file in ASP.NET. On my Web page, I have a linkbutton "Export data". This link will call a Sub Function to perform exporting ALL data from the datagrid control. Exporting data works fine when I show all data on the datagrid control. I'd like to shows only 30 records on the datagrid control instead of ALL data using page navigation, and perform exporting...
4
2072
by: BizWorld | last post by:
I am getting this error in exporting a crystal report (having two subreports) using C# code. i got the following exception at Export statement. Exception Details: CrystalDecisions.CrystalReports.Engine.ExportException: Error in File C:\WINDOWS\TEMP\temp_015d322b-ea06-426e-92d3-656ad11ef627.rpt: Error detected by export DLL: ..........................here is the report
3
2059
by: David P. Donahue | last post by:
I'm re-writing an application in C# that was originally written in Delphi 7. The heart of the application is a DataSet displayed in a DataGrid. One of the main functions of the previous application was to save the data to a file (it was XML, but the format is unimportant) that can be re-loaded into the DataSet at a later time. (The reason for this was that the queries which populate the DataSet can take a while to run, and people...
0
1513
by: Mike Collins | last post by:
I am trying to export data from multiple tables in SQL Server to an XML file so I can then import it to another database. It seems to be working fine for exporting, but I am having trouble importing the file. Can someone show me where I am going wrong. Even though I say the export is working, I am including it below in case there is something in there that needs to be changed. Also, the code I am including is VERY rough right now and will...
6
8245
by: sara | last post by:
I have what I think is a little strange...I have to get data from our payroll system into a specific format (fixed record length) as a .txt or .prn file only to upload to our 401k custodian. I can get the data into Access (from Payroll) and write a query with all the fields (inserting fields with spaces, as needed), but I can't figure out how to get it to export to a .txt file - without the field name header row. I don't really ...
0
9796
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
9643
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
10503
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...
1
10544
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9326
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
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
5624
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...
1
4425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3079
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.