C
Catalin Porancea
Hello,
I want to read a file that has several thousands lines, line by line and
load every line in a string. The problem is that the file is created on a
Unix machine which doesn't and the line with a carriage return (hexadecimal
0x000d) or a line feed (hexadecimal 0x000a). If I open the file with
Notepad, the file looks scrambled and where the line was supposed to end
there is a strange character that looks like a square and I cannot even copy
it. Because of that the ReadLine doesn't stop where it is supposed to and
keeps reading beyond that character.
____________________________________________________________________________
___
Dim fsr As StreamReader = File.OpenText(strPath)
Dim s As String
While fsr.Peek <> -1
s = fsr.ReadLine
cmd.CommandText = "insert into import_temp (record,fileid) values ('" & s &
"','" & strImport_FileID & "')"
Try
cmd.ExecuteNonQuery()
Catch Ex As Exception
lblMSG.Text = "Error: " & Ex.Message.ToString()
Finally
End Try
____________________________________________________________________________
___
Can anybody help with this?
Thank you,
Catalin
I want to read a file that has several thousands lines, line by line and
load every line in a string. The problem is that the file is created on a
Unix machine which doesn't and the line with a carriage return (hexadecimal
0x000d) or a line feed (hexadecimal 0x000a). If I open the file with
Notepad, the file looks scrambled and where the line was supposed to end
there is a strange character that looks like a square and I cannot even copy
it. Because of that the ReadLine doesn't stop where it is supposed to and
keeps reading beyond that character.
____________________________________________________________________________
___
Dim fsr As StreamReader = File.OpenText(strPath)
Dim s As String
While fsr.Peek <> -1
s = fsr.ReadLine
cmd.CommandText = "insert into import_temp (record,fileid) values ('" & s &
"','" & strImport_FileID & "')"
Try
cmd.ExecuteNonQuery()
Catch Ex As Exception
lblMSG.Text = "Error: " & Ex.Message.ToString()
Finally
End Try
____________________________________________________________________________
___
Can anybody help with this?
Thank you,
Catalin