I have a button on my winform that is exporting a sql table to a text file. It works fine but I have a few fields that are date (not date/time) but when it exports it is adding a time. Is there a way to just export the date that is in the table?This is what it looks like after it is exported. 11-06-08-01 3/14/2014 12:00:00 AM 6/8/2011 12:00:00 AM
This is the code I am running to export that SQL table.Dim ds As New WebUpdateDataSet Dim ta As New WebUpdateDataSetTableAdapters.DataTable1TableAdapter ta.Fill(ds.DataTable1) Dim dt As DataTable = ds.Tables("DataTable1") Export("c:\ftpalloneea\awww.txt", dt)
Here is my export code. Public Sub Export(ByVal path As String, ByVal table As DataTable) Dim output As New StreamWriter(path, False, UnicodeEncoding.Default) Dim delim As String delim = "" ' write out each data row For Each row As DataRow In table.Rows delim = ControlChars.Tab For Each value As Object In row.ItemArray output.Write(delim) If TypeOf value Is String Then output.Write(value) Else output.Write(value) End If delim = ControlChars.Tab Next output.WriteLine() Next output.Close() End Sub
Thanks,Stacy