Exporting DataTable using FileHelpers

Posted by Dat on Stack Overflow See other posts from Stack Overflow or by Dat
Published on 2009-03-19T18:25:40Z Indexed on 2010/05/17 11:40 UTC
Read the original article Hit count: 243

Filed under:
|

I want to export the contents of a DataTable to a text delimited file using FileHelpers, is this possible? Here is what I have so far:

// dt is a DataTable with Rows in it
DelimitedClassBuilder cb = new DelimitedClassBuilder("MyClassName", "|", dt);
Type t = cb.CreateRecordClass();
FileHelperEngine engine = new FileHelperEngine(t);

I have to convert the contents of dt to an array of type "MyClassName" but I'm not sure how to do that? I know there is a FileDataLink class but none of them work with DataTable (or even a DataSet).

© Stack Overflow or respective owner

Related posts about .NET

Related posts about filehelpers