文本文件生成和读取处理出错!进来帮忙看一下是咋回事

文本文件生成和读取处理出错!进来帮忙看一下是怎么回事?
PPC2003系统上的程序通过DATASET返回数据,然后把DATATABLE里的数据取出来生成文本,字段以CHA(9)分隔,但是PDA在读取生成文件的时候会出错,拷贝到PC上又看不到什么问题...
如果我用BCP生成的文本文件,读取又不会出错,,谁能给我检查一下,,,

以下是代码

PDA上面生成的文本数据代码是:    
                                Dim   sw   As   StreamWriter
                                sw   =   New   StreamWriter(g_configdir   +   filename   +   g_hzm)
                                For   j   =   0   To   datatable.Rows.Count   -   1     \\逐行读取数据
                                        data   =   datatable.Rows(j).Item(0).ToString   +   Chr(9)   +   datatable.Rows(j).Item(1).ToString   +   Chr(9)   +   datatable.Rows(j).Item(2).ToString
                                sw.WriteLine(data)
                                Next
                                sw.Close()


读文本的代码是:
                        Dim   mysr   As   StreamReader
                Try
                        mysr   =   New   StreamReader(filepath,   System.Text.Encoding.Default)
                Catch   ex   As   Exception
                        MsgBox( "打开文件出错! ")
                        Exit   Function
                End   Try
WHILE(不是文件末尾)

                        str   =   mysr.ReadLine   //读一行处理一行
                        If   str   =   " "   Then
                                Exit   Function
                        End   If
                        Dim   i   As   Integer   =   0
                        Dim   len   As   Integer   =   str.Length
                        Dim   str2()   As   Char   =   str   +   " "
                        While   (str2(i)   <>   chr(9)And   i   <   len)
                                dm   =   dm   +   str2(i)