Android Question JdbcSQL can't insert record from real android device

taufik adi sanjaya

Member
Licensed User
Longtime User
B4X:
Where is mistake ???, somebody have idea ? Insert record success with emulator mode but failed with real android device

Sub lvlagu_ItemClick (Position As Int, Value As Object)
    Dim cari,dataku As String
    cari = lvlagu.GetItem(Position)
    'Log(cari)
    
    Wait For (Connect) Complete (Success As Boolean)   
    If Success Then
        Try
            dataku = "SELECT * FROM datautm where no ="""&cari&""""
            Dim sf As Object = mysql.ExecQueryAsync("mysql", dataku ,Null)
            Wait For (sf) mysql_QueryComplete (Success As Boolean, Crsr As JdbcResultSet)
            If Success Then   
                Crsr.NextRow
                'Log($"NO: ${Crsr.GetString("no")}, Judul: ${Crsr.GetString("jdl_lagu")}"$)                                                           
            
                noku = Crsr.GetString("no")
                jdla = Crsr.GetString ("jdl_lagu")
                penyanyi  = Crsr.GetString("penyanyi")
            
                Crsr.Close                   
                pilih
            End If
        Catch
            Success = False
        End Try
    End If   
    '*** INSERT NEW RECORD TO PLAYLIST ***' 25-10-2019
    'pilih
End Sub

Sub pilih
    Wait For (Connect) Complete (Success As Boolean)
    If Success Then
        Try           
            mysql.ExecNonQuery("INSERT INTO pc1 (no,jdl_lagu,penyanyi) Values ('" &noku&"','"&ReString(jdla)&"','"&penyanyi&"')")
        Catch
            Success = False
        End Try
    End If
    lvlist.AddSingleLine(jdla)
End Sub
 
Top