I had the need to insert images in my database. I think I succeeded, but I can not determine if I did correctly. This is my code to insert (including Sqlite connection, if someone serves you):
When Open the Card:
Code: Select all
on opencard
global ConID
#SE DEFINE LA CARPETA DONDE SE ENCONTRARÁ NUESTRA BASE DE DATOS
put specialFolderPath("Desktop")&"/Herba.sqlite" into tDatabasePath
#CONEXIÓN COMO TAL
put revOpenDatabase("sqlite", tDatabasePath, , , ,) into tDatabasePath
#VERIFICAMOS QUE LA CONEXIÓN NO TENGA ERRORES
put tDatabasePath into ConID #ASIGNAMOS ID DE CONEXIÓN
put "Conexion ID:"& ConID into fld "CID"
put "CREATE TABLE IF NOT EXISTS usuarios (id_usuario integer primary key autoincrement,imagen MEDIUMBLOB);"into tSQL
revExecuteSQL ConID,tSQL
put the result into resultado
if resultado = 1 then
answer info "Se inició la conexión correctamente"
else
answer error resultado
end if
end opencard
Code: Select all
on mouseUp
global conID
put the text of img "image" into tLogo64
put "insert into usuarios (imagen) values (:1)" into tSQL
revExecuteSQL ConID,tSQL, "*btLogo64"
put the result into resultado
if resultado = 1 then
answer info "Se insertaron los datos correctamente"
else
answer error resultado
end if
end mouseUp
If correct, how could show these images that I picture stored in another box? ... Following the same connection sqlite ....
Thank you very much and best regards!