Groups | Blog | Home
all groups > vb.net data > may 2006 >

vb.net data : Export DataTable to CSV file


shriop
5/9/2006 9:00:58 AM
I don't know if commercial applications are a possibility, but the CSV
parser I sell, http://www.csvreader.com , also has a writer that has a
method called WriteAll that will handle all of this in just a couple
lines of code, and will blow through this in less than a second no
problem.

Bruce Dunwiddie

[quoted text, click to view]
Tom Rahav
5/9/2006 5:36:36 PM
Hi,

I have a DataTable that I need to convert to a CSV file, in the fastest and
less resources demanding way.
I did it by creating a MS Excel object, Worksheet object, etc. and running
over each row and column in the DataTable and writing it to the Excel sheet.
It's working, but v-e-r-y slow... my DataTable has about 800 rows and 26
columns and it takes more than 2 minutes per file.
Can someone tell me please what is the fastest way to do that?
BTW, I use VB.NET 2005.

Thanks!
Tom/

james
5/10/2006 8:38:18 AM
If it's a one time thing, why not use Access to do your conversion? (that is
if it's an Access database data table). If it's an on-going need, then you
can write code that will parse the table's data out to CSV.
james

[quoted text, click to view]

Jeff North
5/11/2006 2:02:43 AM
On Tue, 9 May 2006 17:36:36 +0200, in
microsoft.public.dotnet.languages.vb.data "Tom Rahav"
<tomrahav@nospam.nospam>
[quoted text, click to view]

There is really no need to create the Excel object (unless you are
adding formulae and other formatting information).

Simply output the data to a text file, with the CSV extension and then
let the users' Excel app do all the work :-)
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
AddThis Social Bookmark Button