Other JRDC2 remote BLOB

Rachbob

Member
Licensed User
Hello
I need to download images from a remote database (BLOB). please i want some code samples. thank you.
 

Rachbob

Member
Licensed User
thanks Erel for reply.
i tried the code below but it doesn't work. could you please see what is wrong. thanks again..

B4X:
Sub GetImage
    
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("select_all", Null)
  
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        'work with result
        Dim Blob As Byte
        Blob = req.BytesToImage(res.Rows)
        ImageView1.Bitmap=LoadBitmap(Blob,"")
        
        req.PrintTable(res)
    Else
      
        Log("ERROR: " & j.ErrorMessage)
    End If
    j.Release
  
   End Sub
 
Last edited:
Upvote 0

Johan Hormaza

Well-Known Member
Licensed User
Longtime User
thanks Erel for reply.
i tried the code below but it doesn't work. could you please see what is wrong. thanks again..

B4X:
Sub GetImage
   
    Dim req As DBRequestManager = CreateRequest
    Dim cmd As DBCommand = CreateCommand("select_all", Null)
 
    Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
    If j.Success Then
        req.HandleJobAsync(j, "req")
        Wait For (req) req_Result(res As DBResult)
        'work with result
        Dim Blob As Byte
        Blob = req.BytesToImage(res.Rows)
        ImageView1.Bitmap=LoadBitmap(Blob,"")
       
        req.PrintTable(res)
    Else
     
        Log("ERROR: " & j.ErrorMessage)
    End If
    j.Release
 
   End Sub
B4X:
        ImageView1.Bitmap = req.BytesToImage(res.Rows)
 
Upvote 0

Rachbob

Member
Licensed User
B4X:
        ImageView1.Bitmap = req.BytesToImage(res.Rows)

it gives error
error.jpg
:
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
it gives error
Please post it as text. Right click to copy.

Your code cannot work. It has nothing to do with blobs. Watch the video tutorial. It explains how to access items.

Something like:
B4X:
For Each row() As Object In res.Rows
 Dim blob() As Byte = row(res.Columns.Get("BlobColumn"))
 'now convert it to an image
Next
 
Upvote 0
Top