I need to replace( , to ^) and( . to |)charaters while exporting data from sql to csv .Where can i change the code for mentioned character in below code
Code:
command.CommandText = "SpGetData"; command.CommandType = CommandType.StoredProcedure; SqlDataAdapter dataAdapter = new SqlDataAdapter(command.CommandText, connect); dataAdapter.Fill(dataSet, "SpGetData"); DataTable t1 = dataSet.Tables["SpGetData"]; string csv1 = string.Empty; foreach (DataColumn column in t1.Columns) { csv1 += column.ColumnName + ','; } foreach (DataRow row in t1.Rows) { foreach (DataColumn column in t1.Columns) { csv1 += row[column.ColumnName].ToString().Replace(",", ";") + ','; } } string filename = exportPath + "Data" ; File.WriteAllText(filename, csv1);