I am reading a field as Binary and want to use as string function on it.
How do I convert it to string? If I try to use CStr and get an error.
How do I do a search on this. I am trying to find the word "SUBJECT:" and then get all the text up to 2 tabs. If I read it into a string I can use the following:
But I need to convert it to a string to do it. Is there a better way to work on the data as a Byte array (since I already have it that way)? Cstr(arrByteData) gives me an error saying I can't convert Bytes to String.
Thanks,
Tom.
How do I convert it to string? If I try to use CStr and get an error.
Code:
Dim arrByteData As Byte()
while (objDataReader.Read() = true)
if(objDataReader(0) is System.DBNull.value) then
exit while
else
arrByteData = Ctype(objDataReader(0),Byte())
response.BinaryWrite(arrByteData)
end if
end while
How do I do a search on this. I am trying to find the word "SUBJECT:" and then get all the text up to 2 tabs. If I read it into a string I can use the following:
Code:
dim indexStart as Integer
dim indexEnd as Integer
dim indexCount as Integer
dim theString as String
indexStart = strContents.IndexOf("SUBJECT:")
indexEnd = strContents.IndexOf(chr(7) & chr(7),indexStart)
theString = mid(strContents,strContents.IndexOf("SUBJECT:")+10,indexCount)
indexCount = (indexEnd - indexStart) - 10
response.write("string is = " & theString & "<br><br>")
But I need to convert it to a string to do it. Is there a better way to work on the data as a Byte array (since I already have it that way)? Cstr(arrByteData) gives me an error saying I can't convert Bytes to String.
Thanks,
Tom.