Hello,
In xojo 2023r4 i made a simple project to store png image in sqlite database.
But when i try to run my code i’ve an error :
HOME.BtnSave.Pressed, line 48
This is not an array but you are using it as one
DummyRS.Column("photo").PictureValue(Picture.Formats.PNG) = pic
My code is
Var file As FolderItem = SpecialFolder.ExternalStorage.Child("test.png")
Var pic As Picture = Picture.Open(file)
Var DummyRS As RowSet = DB.SelectSQL("SELECT id, photo FROM photos WHERE id = ?", DB.LastRowID)
DummyRS.MoveToFirstRow
DummyRS.EditRow
DummyRS.Column("photo").PictureValue(Picture.Formats.PNG) = pic
DummyRS.SaveRow
' rs is a RowSet with an picture column called "Photo" and MyPhoto is a picture:
rs.EditRow
rs.Column("Photo").PictureValue(Picture.Formats.PNG) = MyPhoto
rs.SaveRow
Var db As New SQLiteDatabase
db.Connect // in memory
db.ExecuteSQL("CREATE TABLE photo (id INTEGER PRIMARY KEY, apng BLOB); INSERT INTO photo (id, apng) VALUES (1, NULL);")
Var pic As New Picture(10, 10)
Var rs As RowSet = DB.SelectSQL("SELECT * FROM photo WHERE id = 1;")
rs.EditRow
rs.Column("apng").PictureValue(Picture.Formats.PNG) = pic
rs.SaveRow
db.Close
MessageBox "OK"
Quit