I am building an ASP.NET C# project that has a functionality to export DataTables to CSV files with a |
delimiter for each cell. I want it to look like this:
100001|06/19/1861|Jose|Rizal|Filipino|Calamba, Laguna|
100002|08/30/1850|Marcelo|Del Pilar|Filipino||
100003||||||
As you can see, each 'cell' is delimited by |
. Furthermore, null cells should also have the delimiter. All rows should have the same number of |
delimiter.
So far I have this code:
StringBuilder sb = new StringBuilder();
DataTable dtFile1 = file1BLO.SelectAllFile1();
foreach (DataRow dr in dtFile1.Rows)
{
//build text file
}
You can try: