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??
Tapan PatelPosted Aug 14, 2016, 9:36 PM
Vishal JadavPosted Aug 12, 2016, 4:04 AM
Vinay SinghPosted Aug 12, 2016, 3:17 AM