I am developing a system that in one of the processes, download a .csv file from a Url every day, only this file comes with the columns without titles, I would like to enter the titles in autmaticamenta columns every time it was done download the file.
new row ------->   new value     -    new value     -    new value
                 existing value  -  existing value  -  existing value
                 existing value  -  existing value  -  existing value
                 existing value  -  existing value  -  existing value
My Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.IO;
using System.ComponentModel;
using System.Data;
using System.Globalization;
namespace CotacaoMoeda
{
    class Program
    {
        static void Main(string[] args)
        {
            GetUrlCsv();
        }
        static void GetUrlCsv()
        {
            var dateString = DateTime.Now.ToString("yyyyMMdd");
            //string dateString = "20160520";
            WebClient wc = new WebClient();
            wc.DownloadFile("http://www4.bcb.gov.br/Download/fechamento/" + dateString + ".csv", @"c:\temp\" + dateString + ".csv");
            //Console.Write(dateString);
            //String[] Values = File.ReadAllText(@"c:\temp\" + dateString + ".csv").Split(';');
            string Caminho = @"c:\temp\" + dateString + ".csv";
            StreamReader oStreamReader = new StreamReader(Caminho);
            DataTable oDataTable = new DataTable();
            int rowCount = 0;
            string[] columnNames = null;
            string[] oStreamDataValues = null;
            while (!oStreamReader.EndOfStream)
            {
                string oStreamRowData = oStreamReader.ReadLine().Trim();
                if (oStreamRowData.Length > 0)
                {
                    oStreamDataValues = oStreamRowData.Split(';');
                    if (rowCount == 0)
                    {
                        rowCount = 1;
                        columnNames = oStreamDataValues;
                        foreach (string csvHeader in columnNames)
                        {
                            DataColumn oDataColum = new DataColumn(csvHeader.ToUpper(), typeof(string));
                            oDataColum.DefaultValue = string.Empty;
                            oDataTable.Columns.Add(oDataColum);
                        }
                    }
                    else
                    {
                        DataRow oDataRow = oDataTable.NewRow();
                        for (int i = 0; i < columnNames.Length; i++)
                        {
                            oDataRow[columnNames[i]] = oStreamDataValues[i] == null ? string.Empty : oStreamDataValues[i].ToString();
                        }
                        oDataTable.Rows.Add(oDataRow);
                    }
                }
            }
            oStreamReader.Close();
            oStreamReader.Dispose();
            foreach (DataRow Dr in oDataTable.Rows)
            {
                string RowValues = string.Empty;
                foreach (string csvColumns in columnNames)
                {
                    RowValues += csvColumns + "=" + Dr[csvColumns].ToString() + " ";
                }
                Console.Write(RowValues);
            }
            Console.ReadKey();
            Console.ReadLine();
        }
    }
}