Android Question SD: BindingNavigator (Sqlite GUI Navigator) Not Save Image in database table

mike1967

Active Member
Licensed User
Longtime User
Hello , i have this code:
code:
Sub Class_Globals
    Private Root As B4XView 'ignore
    Private xui As XUI 'ignore
    Private DBN As NavigatorBar
    Private imgPlanimetria As ImageView
    Private Position As Int=0
    Private btnUpload As Button
    Private btnReset As Button
        
End Sub

'You can add more parameters here.
Public Sub Initialize As Object
    Return Me
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("2")
    If File.Exists(File.DirInternal,"planimetrie.db") = False Then
        File.Copy(File.DirAssets,"planimetrie.db",File.DirInternal,"planimetrie.db")
    End If
    DBN.ConnectDB(File.DirInternal,"planimetrie.db",False)
    DBN.AddLinkView(imgPlanimetria,"planimetria")
    DBN.Query("SELECT * FROM estintori","ID")
    DBN.Position=Position
    DBN.FontAW=Typeface.FONTAWESOME
    
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.

Private Sub DBN_ValueChanged (Value As Int)
    Position=Value
    Log(Position)
End Sub

Sub ButtonUpdate_Click
    
    DBN.UpdateChange
            
End Sub


Private Sub btnUpload_Click
    Dim CC1 As ContentChooser
    CC1.Initialize("CC1")
    CC1.Show("image/*", "Seleziona Planimetria")
        
End Sub

Sub CC1_Result (Success As Boolean, Dir As String, FileName As String)
    If Success=True Then
        imgPlanimetria.Bitmap=LoadBitmap(Dir,FileName)
    End If
End Sub


Private Sub btnReset_Click
    imgPlanimetria.Bitmap=Null   
End Sub

The table estintori have 10 record preloaded with images (blob fields) set to null.
When i upload the image and click on Update Button of NavigatorBar then image are not saved in table of database.

Can someone help me ? Thanks
 

Attachments

  • Layout.png
    Layout.png
    240 KB · Views: 159

Star-Dust

Expert
Licensed User
Longtime User
Is the primary key correct?
When it does an update it identifies the record from the primary key
 
Upvote 0

mike1967

Active Member
Licensed User
Longtime User
Is the primary key correct?
When it does an update it identifies the record from the primary key
In attachement the db :
Table estintori filed ID as integer,primary key,autoincrement;planimetria as blob
 

Attachments

  • planimetrie.zip
    584 bytes · Views: 157
Last edited:
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
try this
B4X:
Sub ButtonUpdate_Click
 
    DBN.UpdateChange
    DBN.Query("SELECT * FROM estintori","ID")
    DBN.Position=Position
End Sub

It is necessary to refresh the resultset to have the data reloaded.

ezgif.com-gif-maker.gif
 

Attachments

  • Plaimetrie.zip
    10.5 KB · Views: 176
Last edited:
Upvote 0
Top