Android Question [SOLVED]Blob Field Containing Picture Not Updating

Big Dave

Member
Licensed User
Longtime User
Is there any difference when it comes to inserting a record containing a blob field to updating the same record. I can read and display the blob picture quite happily but when I try to update the field it does not appear to do so. Not sure if its a coding or logic issue. ECS21 lblTapForPhoto_Click is where I try to create the blob field. Any help/pointers much appreciated.
 

Attachments

  • ExpenseClaimsSystem.zip
    66.3 KB · Views: 247

Mahares

Expert
Licensed User
Longtime User
Any help/pointers much appreciated.
Hi Big Dave:
I am sorry I cannot test your project because I do not have the biometric stuff and Androidx, so I am speculating: Remove or comment OutPhoto.close and put it in the Update sub as I show with my comments below:. I hope it works
B4X:
bmpPhoto.WriteToStream(OutPhoto, 10, "JPEG")
        OutPhoto.Close      'take this line out or comment it and put it after you update the field. 
'        InsertReceiptRecord
        UpdateReceiptRecord

B4X:
Case 4 ' Blob
            Log ("Updating Photo")
            ECS00.SQLEC.ExecNonQuery2(strSQLQuery, _
                Array As Object(OutPhoto.ToBytesArray, ECS20.strSelectedReceiptID))
OutPhoto.Close   'put it here because you were saving a o byte to the table before
 
Upvote 0

Big Dave

Member
Licensed User
Longtime User
Hi Mahares. Tried your suggestion but unfortunately no change. In ECS21 I can retake a picture and want to update the blob field with it. Unfortunately even though the sql seems to work (note to self to try a catch on it) the picture is not changed suggesting that the new picture is not being updated. I will look at creating a stripped down version to see if it can help anyone. Thanks
 
Upvote 0

Big Dave

Member
Licensed User
Longtime User
I have finally resolved this problem albeit after changing my approach and saving pictures as files rather than blob field. The resolution has the same effect either way I believe..... Taking a picture and then immediately saving it seems to result in an empty file, but moving the same to a later point, when exiting the view for example, seems to work. It would suggest that taking the picture needs time to fill the "buffer" before it can be used. Would welcome an answer to this if anyone knows. Mahares many thanks for your help.
 
Upvote 0
Top