Link to home
Start Free TrialLog in
Avatar of Johan Boog
Johan Boog

asked on

How can I retrieve an image(png/gif/...) stored in SQL (Byte[] Array) with VBS and convert to BASE64

I managed to get the data in a Array:

Fielddata = SQLdata.Fields(2).Value
wscript.popup Ubound(Fielddata) 'result in a big number

I tried this :
Dim dom: Set dom = CreateObject("Microsoft.XMLDOM")
Dim elem: Set elem = dom.createElement("tmp")
elem.dataType = "bin.base64"
elem.nodeTypedValue = join(Fielddata)
convertImageToBase64 = "data:image/png;base64," & Replace(elem.text, vbLf, "")

But the join resulting in a Typ Mismatch : 'join'

How can I convert the data from SQL to a BASE64 string?

Thanx,
Johan
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Johan Boog
Johan Boog

ASKER

aikimark, thank you very much. Exactly what I needed and I get it work.
Thank you