Canvas Backdrop name in Sqlite

I stored icons’ names in sqlite db for future use. When I read the name of a picture that I want to use as an icon I get a Type Mismatch Error even if I use:

icon.backdrop = rs.Field(“ICON”).PictureValue

What am I doing wrong?

if its just a string you put in the database then you cant get a PictureValue for it - its not a picture

you would need a way to turn that name into a picture like

   select case Name
     case "Picture1"
            return Picture1 // this is a picture dragged into your project
     case "SomethingElse"
            return SomethingElse
  end select

If a decide not to do the select case, may I put a real picture in the database as a BLOB field instead? If yes, how to retrieve after? I already tried to do this before unsuccessfully.

This should work?

Dim sql as String
Dim myPicture as MemoryBlock
Dim Icone as Picture
Dim rs As RecordSet
sql = “SELECT ICONE FROM CATEGORIAS WHERE CODIGO = '”+Categoria+"’"
rs = App.myDB.SQLSelect(sql)
myPicture = rs.Field(“ICONE”).StringValue
Icone = picture.FromData(myPicture)
Return Icone

Yes

Depends on how you put it in the database
What does that code look like

But yes putting a picture un the db can & does work

Thanks!

One thing I can say works on every database I’ve worked with is to get the picture data, base64 it, and stick that in the db
Then to get the picture reverse that
Since the db just see’s the data as a big string you dont need fancy handing of blobs/clobs/bloba etc - its just a big text item
However you dont want to try & do that where performance is critical because all the fetching & decoding of big chunks of base64 data can take some time