Join the most popular community of UK swingers now
Login

I.T. Help Ref SQl Server please

last reply
3 replies
826 views
1 watcher
0 likes
Hi All
My eldest son is stuck with a problem at work , i know nothing about computers
myself but asked him to send me the problem to post on a couple of boards , i
know its a long shot but any help would be appreciated.
Many Thanks
I was asked to look at something else for the last couple of days so didn’t get a chance to look at this again but I still have the problem when trying to convert this binary formatted image attachment into a byte array that will go into SQL server database. It might be worth you sending this out to your contact to see if they have any idea a brief description of it all is below:
Background
I am receiving an XML document which contains a field called “MMS” which contains a base64 encoded MIME message. What I need to do is decode this message, grab the binary encoded image file information from the MIME message (MIME_ enclosed) and put this into a SQL table with a column type of Image.
Problem
What I am having great difficulty in, is converting the binary image data from the MIME message into the correct format (byte array) to then populate the SQL table.
I have tried the following without any joy (have commented out the previous attempts)
Public Shared Function ConvertStringToByteArray(ByVal stringToConvert As String) As Byte()
'Return (New UnicodeEncoding).GetBytes(stringToConvert)
'Return (stringToConvert)
'Return (stringToConvert)
'Return (stringToConvert)
Return (stringToConvert)
End Function
I think the problem stems from the image being in binary format in the MIME message which is not great as it would be better if it was in base64 but this cannot be changed as we are receiving this from a 3rd party.
A couple of things, but i'm working from guess work here....
Simplify the problem so that it just reads one record and then writes the result to a file that can be checked with a sutable viewer, or possibly to a canvas capable of displaying the graphic..
Check that the format the data is in is valid by checking with the sender... one querk I can think of would be little endian over big endian (mac/unix/pc inconsistancy perhaps?) The other thing is to get the publisher to de-code their own data as proof they havnt made a mistake in the encodement, perhaps theyve put a wrapper around the data so it needs to be unwrapped first?
As I say, im working on guess work and a little reading years ago on mime and c# programing. Also a couple of years writing data to de-code marc bibliograpic data from non IBM machines, boy was that fun... NOT, lol.
Have you looked at this:
Many thanks Jon and JQL will pass your comments on