Hey guys. I've gotten the code I posted a few weeks ago working to export a tab delimited file. (http://www.dreamincode.net/forums/index.php?showtopic=110520&st=)
Now, I've already converted it from tab delimited to "tilde delimited." My goal is to import this flat file created as an EDI 850 Purchase Order. My ordering system rejects the file, yet it looks identical to other working files. My thought is the encoding / format is wrong.
Does anyone know what format the file should be in for this to work? I've tried encoding in ASCII, UTF7, UTF8, UTF32 and Unicode with no avail. Hare are two example files to show what works and what I have:
CODE
Working:
HDR~PO-0156~06/30/2009
DET~0603-1162623~25
DET~0603-1602473~5
DET~0603-1718421~25
CODE
Not Working:
HDR~PO-11456~06/29/2009
DTL~0103-3816HSSEH5~1
DTL~0603-1162822~10
DTL~0603-1183290~10
Here's the chunk of code where it creates the file and writes to it:
CODE
If System.IO.File.Exists(filename) = True Then
File.Delete(filename)
Else
End If
writer = New StreamWriter(filename, True, System.Text.Encoding.UTF8)
DBconn.Open()
'Start SQL Results Reader
dr = qACimport.ExecuteReader()
'Write Headers
writer.WriteLine("HDR~" & vPO & "~" & getdate.ToString("MM/dd/yyyy"))
'Write Data
Do Until dr.Read = False
writer.WriteLine("DTL~" & dr.GetValue(2) & "~" & dr.GetValue(5))
Loop
writer.Close()
Anyone have EDI experience? Thanks.
This post has been edited by jmmille: 1 Jul, 2009 - 07:21 AM