write csv file Oledb RRS feed

All replies

  • Although, I'm not too familiar with, the general programming logic would be to use the .Net object DataSet to get to the Tables collection member for the table in question. From here you would iterate through the DataRow collection and DataColumns collection to get to the specific table data cells.


    While iterating through these you would write these out to a string which would then be passed to a StreamWriter to write to a file.


    Hope this helps.
    Wednesday, September 12, 2007 10:12 PM
  • Do you have code sample for what you are saying?


    Thursday, September 13, 2007 1:41 AM
  • Fastest way to do this is to use classes from Sytem.IO namespace, which allow writing any information into the file. Basically you need to loop through the DataRows in your DataTable and write values from the columns into the file, outputting delimiters between the values. Next sample shows you how to write into text file



    Thursday, September 13, 2007 11:43 AM
  • I forgot to mention that it is ADO.Net.  Also, is there a way to write the whole file out from the dataset instead of using datarows and datacolumns.


    Thursday, September 13, 2007 5:41 PM
  • There is no built-in class in .NET Framework to do it in one pass. You either need to loop or store DataSet/DataTable into XML using WriteXml method and then transform to CSV form. If you need it to do in on shot, you could try control on my site to see if it fits your needs.


    Friday, September 14, 2007 10:39 AM