I'm using the following code to write to a csv
Dim str As New StringBuilder
Dim dr As DataRow
Dim field As Object
Dim column As DataColumn
myds.Tables(0).AcceptChanges()
For Each column In myds.Tables(0).Columns
str.Append(column.ColumnName.ToString & ",")
Next
str.Replace(",", vbNewLine, str.Length - 1, 1)
For Each dr In myds.Tables(0).Rows
For Each field In dr.ItemArray
str.Append(field.ToString & ",")
Next
str.Replace(",", vbNewLine, str.Length - 1, 1)
Next
Try
My.Computer.FileSystem.WriteAllText("C:\Users\filePath\myFile.csv", str.ToString, False)
Catch ex As Exception
MessageBox.Show("Write Error")
End Try
One of my fields holds dates in the format 'dd/mm/yy' but when written to the csv appear as 'dd/mm/yy 00:00:00'. Is there a way I can specify the date format on writing to the csv?