J
Jason Roozee
The following doesnt work. The PeekChar either gives me an error
EndOfStreamException or gives me Index out of bounds error. All I am trying
to do is load the contents of the file in to a string. The file is a crystal
reports file. I am trying to take the file and store it in to a sql server
2000 database in to a "text" field. When I try to load the data in to a Char
array and then convert the array to a string -- the data doesnt match. Some
characters are converted to null, etc.
Any ideas whats wrong or how I should be doing this?
Dim fileDataStream As FileStream = New FileStream(ReportFile.Text,
FileMode.Open, FileAccess.Read, FileShare.None)
Dim fileDataBinaryReader As BinaryReader = New BinaryReader(fileDataStream)
fileDataBinaryReader.BaseStream.Seek(0, SeekOrigin.Begin)
Do Until fileDataBinaryReader.PeekChar = -1
FileData.Append(fileDataBinaryReader.ReadChar)
Loop
EndOfStreamException or gives me Index out of bounds error. All I am trying
to do is load the contents of the file in to a string. The file is a crystal
reports file. I am trying to take the file and store it in to a sql server
2000 database in to a "text" field. When I try to load the data in to a Char
array and then convert the array to a string -- the data doesnt match. Some
characters are converted to null, etc.
Any ideas whats wrong or how I should be doing this?
Dim fileDataStream As FileStream = New FileStream(ReportFile.Text,
FileMode.Open, FileAccess.Read, FileShare.None)
Dim fileDataBinaryReader As BinaryReader = New BinaryReader(fileDataStream)
fileDataBinaryReader.BaseStream.Seek(0, SeekOrigin.Begin)
Do Until fileDataBinaryReader.PeekChar = -1
FileData.Append(fileDataBinaryReader.ReadChar)
Loop