Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Export dataset to CSV

stevenhollidgestevenhollidge Posts: 2Member

Hi,

I need to create a CSV file from SQL Server data from an ASP.NET or VB.NET app to mailmerge with MS Word.

I can populate a dataset from SQL Server and write to XML but MS Word can't use XML as a data source - damn!

Anyone got any ideas - other than cycling through the dataset and manually creating the text csv file?

Hopeful,
Steve

Comments

  • Chris__BChris__B Posts: 51Member
    Hi Steve,

    I've been looking for the exact same thing and have yet to find it. Currently I'm looping through a DataReader to create the CSV file and the performance isn't too bad (but obvioulsy not ideal). If you do come across it please post it and I'll do likewise.

    Chris

    :
    : Hi,
    :
    : I need to create a CSV file from SQL Server data from an ASP.NET or VB.NET app to mailmerge with MS Word.
    :
    : I can populate a dataset from SQL Server and write to XML but MS Word can't use XML as a data source - damn!
    :
    : Anyone got any ideas - other than cycling through the dataset and manually creating the text csv file?
    :
    : Hopeful,
    : Steve
    :

  • stevenhollidgestevenhollidge Posts: 2Member
    Hi Chris,

    Yeah I've done the same, but...

    I'm trying to create the CSV on the client machine (the app is an asp.net website) by when you use the IO.StreamWriter(file_name, False) code it just creates the CSV file on the server... any ideas?

    Cheers,
    Steve

    PS Will post another reply if I find dataset.WriteToCSV :o)

    : Hi Steve,
    :
    : I've been looking for the exact same thing and have yet to find it. Currently I'm looping through a DataReader to create the CSV file and the performance isn't too bad (but obvioulsy not ideal). If you do come across it please post it and I'll do likewise.
    :
    : Chris
    :
    : :
    : : Hi,
    : :
    : : I need to create a CSV file from SQL Server data from an ASP.NET or VB.NET app to mailmerge with MS Word.
    : :
    : : I can populate a dataset from SQL Server and write to XML but MS Word can't use XML as a data source - damn!
    : :
    : : Anyone got any ideas - other than cycling through the dataset and manually creating the text csv file?
    : :
    : : Hopeful,
    : : Steve
    : :
    :
    :

Sign In or Register to comment.