0

Hi I have a code in C# that works fine, in which the source of data is SQL DB. Is there any way in C# to change the source from SQL DB to CSV file.A part of my code looks like:

DataTable dtEmployes = DB.TakeEmployes();
dgvEmployes.DataSource = dtEmployes;
dgvEmployes.Columns[0].Width = 40;
dgvEmployes.Columns[1].Width = 80;
dgvEmployes.Columns[2].Width = 80;
dgvEmployes.Columns[3].Width = 80;
dgvEmployes.Columns[4].Width = 70;
John Saunders
  • 160,644
  • 26
  • 247
  • 397
bali katravella
  • 57
  • 1
  • 2
  • 9
  • 1
    This source is not complete. It appears `dgvEmployes` is some kind of UI component? And `DB.TakeEmployes()` is not shown, but that is where you should read in the CSV file and return a DataTable. Overall this isn't really a question, you should search for how to read a CSV file in C#. – BenSwayne May 28 '13 at 23:39
  • I'm a tad unclear. Are you trying to take the database contents and WRITE them to a CSV, or are you trying to just change the lines of code with the database commands to a CSV data source? – nerdenator May 29 '13 at 00:19
  • @AaronMcRuer Thank you for your response, I'm trying just change the lines of code with the database commands to a CSV data source! – bali katravella May 29 '13 at 01:42

0 Answers0