locked
Generating different files from Source in different destination formats using customized templates RRS feed

  • Question

  • User793621416 posted

    I need to use a source data (basically a database table with different columns and data loaded or a csv file) and then create different files (lets call them destination files) in different formats (text,excel,pdf etc) based on source data using mappings from columns in source data to columns in destination files. The format and no. of columns would be different for different destination files but source data would be same for all. If a new destination file needs to be created in future, the solution design should as simple as just adding another template for the new file and add to existing templates set.

    any idea on above approach please, what comes in my mind is xml templates using xsd schema but any code references to the said approach would be greatly appreciated. Also, any other strategies and code references for the same would also help.

    Source data - can be SQL database table or a CSV file

    need to write in C#

    Tuesday, March 8, 2016 11:45 AM

All replies

  • User197322208 posted

    DataTable is the most generic approach

    Wednesday, March 9, 2016 3:57 PM
  • User793621416 posted

    Can you please a bit specific. Thank You.

    Thursday, March 10, 2016 5:46 PM
  • User197322208 posted

    read the sql with IDataReader. This have a

    .ToDataTable 

    function to transform in DataTable. 

    And you can put any dynamic select into a datatable

    Tuesday, March 15, 2016 3:23 PM