VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 300,430 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,494 people online right now. Registration is fast and FREE... Join Now!




Create flat EDI file?

 

Create flat EDI file?

jmmille

1 Jul, 2009 - 07:20 AM
Post #1

New D.I.C Head
*

Joined: 16 Jun, 2009
Posts: 6


My Contributions
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

User is offlineProfile CardPM
+Quote Post


jmmille

RE: Create Flat EDI File?

2 Jul, 2009 - 11:26 AM
Post #2

New D.I.C Head
*

Joined: 16 Jun, 2009
Posts: 6


My Contributions
Bump. I'm still struggling with this. Has anyone accomplished this before?

Thanks
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/8/09 12:35AM

Live VB.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month