HI Sathish
basically you are not supposed to ask the complete code directly, you shall try something and if u face any difficulty in that approach you can post the same here.
asking the code is not encouraged in this forum. :)
for now you can try the below .
string folderLocation = @"D:\CodeProject\temp";
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] { new DataColumn("Column1"), new DataColumn("Column2"), new DataColumn("Column3") });
dt.Rows.Add("Row-1-Column-1", "Row-1-Column-2", "Row-1-Column-3");
dt.Rows.Add("Row-2-Column-1", "Row-2-Column-2", "Row-2-Column-3");
dt.Rows.Add("Row-3-Column-1", "Row-3-Column-2", "Row-3-Column-3");
for (int i = 0; i < dt.Rows.Count; i++)
{
string fileName = folderLocation + "\\" + "File-" + i + ".txt";
string contents = "";
foreach (DataColumn col in dt.Columns)
contents += dt.Rows[i][col].ToString() + " ";
System.IO.File.WriteAllText(fileName, contents);
}