Salve is just that I use xojo
Lately I’ve found a little difficulty I can not save or update an image attached to the db
1 - I created the field as blob
2 run this code to save him but not fuziona
'Opening the database
Dim dbFile As FolderItem
Dim db As New SQLiteDatabase
dbr dim as recordset
dbFile = GetFolderItem (“C: \ Users \ Rico Vast \ Documents \ project-xojo / database.sqlite”)
db.DatabaseFile = dbFile
Then if db.connect
// Proceed with database operations here …
'MsgBox (“Data base successfully opened”)
'Queries generic creating the recordset
Dim p As Picture = Canvas1.Backdrop
Dim mb As MemoryBlock = p.GetData (Picture.FormatJPEG, Picture.QualityMax)
Dim s As String = mb
db.SQLexecute ("INSERT INTO test (code, name, first name, photo) VALUES ('" + codicetxt.text + "', '" + cognometxt.text + "', '" + nometxt.text + "', '" + s + "')")
db.SQLExecute ("COMMIT")
Else
MsgBox (“Do not be opened because the Db. Error:” + db.ErrorMessage)
End If
The same thing happens in the process of renovation
Dim dbFile As FolderItem
Dim db As New SQLiteDatabase
dim selected as string
dbFile = GetFolderItem (“C: \ Users \ Rico Vast \ Documents \ project-xojo / database.sqlite”)
db.DatabaseFile = dbFile
selected = Listbox1.Cell (ListBox1.Listindex, 0) .ToText
Then if db.connect
// Proceed with database operations here …
'MsgBox (“Data base successfully opened”)
'Queries generic creating the recordset
As picture dim p = Canvas1.Backdrop
Dim mb As MemoryBlock = p.GetData (Picture.FormatJPEG, Picture.QualityMax)
Dim s As String = mb
db.SQLExecute ("BEGIN TRANSACTION")
db.SQLexecute ("update test in September last name = '" + cognometxt.text + "'" + "name = '" + nometxt.text + "'" + "photo =" + s + "where code = '" + selected + " '")
db.commit
If db.Error Then MsgBox (db.ErrorMessage)
Else
MsgBox (“Do not be opened because the Db. Error:” + db.ErrorMessage)
End If
Definitely wrong to do something
Thanks for your help