read Image from Text Column in VB.Net Client from MSSQL Server -


it's similar problem how load image sql server picture box?

but in case image column in db type of "text", doesn't allow me convert byte array:

byte[] data = new byte[0]; data = (byte[])(dataset.tables[0].rows[0]["pic"]); 

i have table mamedia images stored in column ma_bild: table mamedia

now need read image column ma_bild using vb.net - have far:

sql statements

in vb.net can't convert value of text column byte() array

dim byteblobdata1() byte = directcast(fototable.rows(0).item("ma_bild"), byte()) 

-> error message: "system.string" can't converted type "system.byte[]"

the fototable datatable holds following values (only 1 row):

  • mabild_id: 9a8d4fa7-57cd-4720-a397-158e2336d0ec
  • ma_id: 3b686451-c9d3-4bcd-acf5-2fa407325837
  • ma_bild: ÿØÿମ2†hç­iûeþÝš÷Ũn–¹¸¸ºÛÁ7˜hÿ... (goes on ~50000 characters)
  • ma_bild_textptr: system.byte[] = value of ptrval

any ideas how read image information vb.net client?

last option convert image in old foxpro client additional blob colomn.

*edit: tried encoding in order compare did following steps:

  • i stored picture in db (via old foxpro client)
  • created byte array of picture harddrive (vb.net)
  • read bytes db , encoded them (vb.net)

-> i.e.: system.text.encoding.unicode.getbytes(fototable.rows(0).item("ma_bild"))

i tried encoding methods (unicode, utf7, utf8, utf32, bigendianunicode) , compared byte arrays array original picture.

but unicode/bigendianunicode result similar. problem: unicode byte array twice long original byte array created directly picture.

-> every second byte unicode encoding 0, created new byte array every second byte, but... table comparison ... unfortunately of entries aren't correct...

this result:

picture comparison


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -