0

I have a code for getting the csv from datatable . But i can't save the csv formatted file. How can I save ?

File.WriteAllText("test.csv", sb.ToString()); 

This is not working?

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Binoop
  • 171
  • 1
  • 2
  • 14

1 Answers1

0

Why aren't u using xls or xlsx instead of csv? If you want to use xls or xlsx you can look at nopcommerce opensource projects source code. You can download it from

http://nopcommerce.codeplex.com/downloads/get/598641

And then open the project with

visual studio 2012

Go to Nop.Services project under Libraries solution folder. There is a folder in this project named "ExportImport" you can look at the codes.

But if you want csv you can look at following posts

Write to CSV file and export it?

How to create CSV Excel file C#?

https://stackoverflow.com/questions/12418520/jquery-c-sharp-export-to-csv

http://www.codeproject.com/Articles/8411/C-class-library-for-exporting-data-to-CSV-Excel-fi

Community
  • 1
  • 1
ersin ceylan
  • 107
  • 1
  • 6