Android Question ERROR READING BLOB IMAGE DATABASE SQLITE !!

MarcioCC

Member
Licensed User
Longtime User
good night, insert a picture in my database SQLite now want to read the image, more ta giving the following error when I run the app: android.database.sqlite.SQLiteException: no such column: name (code 1):, while compiling: SELECT * FROM WHERE name = TBFILMES?
The error is giving this line: Cursor1 = s.ExecQuery2 ("SELECT PHOTO FROM TBFILMES WHERE name =?" Array As String (""))
What am I doing wrong??
 

MarcioCC

Member
Licensed User
Longtime User
hit the column more now ta giving this error: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
 
Upvote 0

mangojack

Expert
Licensed User
Longtime User
The error is giving this line: Cursor1 = s.ExecQuery2 ("SELECT PHOTO FROM TBFILMES WHERE name =?" Array As String (""))
B4X:
Cursor1 = SQL1.ExecQuery2("SELECT FOTO FROM TBFILMES WHERE name = ?", Array As String("TheImageNameYouWantToGet"))

as @LucaMs suggested .. after your query check cursor rowcount ..
B4X:
Log(Cursor1.RowCount)

Cursor1.Position = 0
Dim Buffer() As Byte 'declare an empty byte array
Buffer = Cursor1.GetBlob("FOTO")

It might be better if you post the full sub for a clearer look at your code ..
 
Upvote 0

MarcioCC

Member
Licensed User
Longtime User
taking advantage of the post know why is giving this error ??
Error occurred on line: 82 (DBUtils)
java.lang.RuntimeException: Object should first be initialized.
line that is giving the error: SQL.BeginTransaction
 
Upvote 0
Top