locked
SQL Server export to text file using VB.NET RRS feed

  • Question

  • I'm trying to create a VB.NET utility that will run a SELECT statement against a SQL Server 2000 database and then return the results to ASCII files with fixed-field lengths.  I've gotten to the point where I can get the data from the SELECT statement into a DataSet, but I'm lost on how to move/copy that data then to a text file.

     

    I've done similar things piece meal with DTS and VB.NET, but now I want to put everything under VB.NET that a user can execute on their desktop.

     

    Thanks

    Monday, July 23, 2007 4:00 PM

All replies

  • Hi,

    although this is not related to a SQL Server problem, you should take a look here:

    http://dotnetguts.blogspot.com/2007/01/exporting-datatable-to-csv-file-format.html

    Jens K. Suessmeyer

    ---
    http.//www.sqlserver2005.de
    ---
    Wednesday, July 25, 2007 6:53 AM
  • You could use two approaches:

    1. Loop through the rows inside of each DataTable and write content into the file

    2. You could prepare XSL, dump DataSet into XML using WriteXml and then apply XSL against XML to transform data into some form of text file.

     

    Wednesday, July 25, 2007 10:33 AM

  • Please don't multi-post your question to the forum.
    Wednesday, July 25, 2007 12:25 PM