Android Question Sqlite Read Base64 String Error

BensonHung

Member
Licensed User
Longtime User
I will convert the image to base64 and insert to sqlite.
But when I read sqlite, it is an error:
my code:
B4X:
        CursorDBPoint1= SQLcmd.ExecQuery("select * from FileTemp")      
        For ii = 0 To CursorDBPoint1.RowCount - 1
            CursorDBPoint1.Position = ii
            Dim fileName,fileLink As String
            fileName = CursorDBPoint1.GetString("fileBase64")
        Next
What can I do ?
Thanks everyone~
 

BensonHung

Member
Licensed User
Longtime User
Thank you Erel

Column name is correct.
Some phones can properly run,Some phones error occurs.

sqlite file link: https://drive.google.com/file/d/0B9iUMNet17OwdFprWjBlandFa1U/view?usp=sharing

image to base64 code
B4X:
        Dim Base64Con As Base64Image
        Dim B64Str As String = Base64Con.EncodeFromImage(File.DirDefaultExternal, "123.jpg")
        Dim Insstr As String
        Insstr = "INSERT INTO QuotationTempFile(fileBase64) VALUES('"& B64Str &"')"
        SQLcmd.ExecNonQuery(Insstr)

Search base64 code
B4X:
        Dim fileName As String
        CursorDBPoint1= SQLcmd.ExecQuery("select * from QuotationTempFile")   
        For ii = 0 To CursorDBPoint1.RowCount - 1
            CursorDBPoint1.Position = ii
            fileName = CursorDBPoint1.GetString("fileBase64")
        Next
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…