Database table -> Picture -> Read

Hello

I have a table in Microsoft SQL Server that contains data with a picture. When retrieving a specific record, I’m trying to display the picture in a Bevel button and absolutely can’t figure out how to do this :frowning:
My picture is stored in a Varbinary(Max) field.
Any help would be appreciated.
Thank you.

Best regards,
C.

First of all, are you getting any data back? There was at one time a problem with sql server and (Max) fields.

Second, how is the data stored? From Xojo? Using GetData? Read from a file?

What have you tried, and what was the result?

How is your data bound to the interface? Meaning: how does the canvas know when to show what data?

When you know how to do this then use FromData http://documentation.xojo.com/index.php/Picture.FromData to make a picture which you can then paint into the canvas?

Ok, I figured that it works well using MBS Picture plugin (BinaryStringtoPictureMBS) otherwise I could not find any way to deal with the image stored in the database.
Sorry for my initial post, I should have included some code example I’ve been trying…
Thank you.

grab it into a memory block http://documentation.xojo.com/index.php/MemoryBlock
from that you use FromData http://documentation.xojo.com/index.php/Picture.FromData

dim mb as memoryblock = rs.field( whatever field name ).StringValue
dim p as picture = picture.fromdata( mb )

or you can collapse it to one line

dim p as picture = picture.fromdata( rs.field( whatever field name ).StringValue )