I want to show all the data horiozantally in a txt file
Problem is that all the data are overlap
I want to show txt format in
xyz:...
pqr:...
.......................
just like
I have taken all the data in a datatable here:
dtRecords.Rows.Add(obj);
//Build the Text file data.
string txt = string.Empty;
foreach (DataColumn column in dtRecords.Columns)
{
//Add the Header row for Text file.
txt += column.ColumnName + "\t\t";
}
//Add new line.
txt += "\r\n";
foreach (DataRow row in dtRecords.Rows)
{
foreach (DataColumn column in dtRecords.Columns)
{
//Add the Data rows.
txt += row[column.ColumnName].ToString() + "\t\t";
}
//Add new line.
txt += "\r\n";
}
//Download the Text file.
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment;filename=SqlExport.txt");
Response.Charset = "";
Response.ContentType = "application/text";
Response.Output.Write(txt);
Response.Flush();
Response.End();
Can anyone guide me how to do??

Vinay SinghRank #604 · 4K reputationPosted Aug 11, 2016, 11:17 PM EDT
Vishal JadavRank #1,692 · 901 reputationPosted Aug 12, 2016, 12:04 AM EDT
Tapan PatelRank #614 · 3.9K reputationPosted Aug 14, 2016, 5:36 PM EDT