Home All Groups Group Topic Archive Search About

VB (5or6) does something wierd with image data

Author
27 Apr 2006 2:14 PM
geronimi
Vb stores an image (bitmap/jpg) in a SQL2000 image field. For some
reason it doubles the size by adding 00 for each byte. But sometimes it
doesn't add 00 (0000.0000) but 01 or 20 or ?? and also the byte that
should be transferd is changed...
So SQLImageData = Imagebyte + 00
and sometimes
SQLImageData = CHANGEDImagebyte + xx.

Some example data: (hex notation):

A1 => A1 00
03 => 03 00
-----------
91 => 18 20
83 => 92 01
8C => 52 01

Could anybody give me an explanation, because I need to know what is
happening, so I can remove te extra bytes added......

I have already a image when I remove the extra bytes, but with some
wrong data (on the place where things like 8C => 52 01 happen)....

Thx,
Geronimo

Author
27 Apr 2006 2:33 PM
Ken Halter
"geronimi" <webjc***@hotmail.com> wrote in message
news:1146147279.423684.124690@g10g2000cwb.googlegroups.com...
> Vb stores an image (bitmap/jpg) in a SQL2000 image field. For some
> reason it doubles the size by adding 00 for each byte. But sometimes it
> doesn't add 00 (0000.0000) but 01 or 20 or ?? and also the byte that
> should be transferd is changed...
> So SQLImageData = Imagebyte + 00
> and sometimes
> SQLImageData = CHANGEDImagebyte + xx.
>
> Some example data: (hex notation):

You'll probably want to post that question in a VB Classic group.
They all contain "microsoft.public.vb" in their names.
This and all other groups on the MS server that contain "dotnet" or "vsnet"
in
their names are for VB.Net. While some of the code looks the same, they are
very
different products and require a different set of groups.

Try a group with 'database' in its name.

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Author
28 Apr 2006 8:44 AM
geronimi
I found a solution!

I convert the data like this:
ImageData=System.Text.UnicodeEncoding.Convert(Encoding.Unicode,Encoding.Def­ault,ImageData);



and the picture is perfect!!
thx for the help!