Hi
This is the part of the code I use to write from a datatable to a text file seperated by commas. The data is written to the text file delimited by commas OK but it writes a comma on the end of each line which I do not want. How can i remove this?
Thanks
This is the part of the code I use to write from a datatable to a text file seperated by commas. The data is written to the text file delimited by commas OK but it writes a comma on the end of each line which I do not want. How can i remove this?
Thanks
Code:
sw = New StreamWriter(filePath, False)
' write data
For Each row As DataRow In dt.Rows
Dim array As Object() = row.ItemArray
For i = 0 To array.Length - 1
sw.Write(array(i).ToString() & ",")
Next
sw.WriteLine()
Next
sw.Close()