B4J Question How To create Auto Number Using B4j

Makumbi

Well-Known Member
Licensed User
Please help me how i wanted to create an auto number for my ID colum in my Table AndroidUserdata but iam failing to implement it

B4X:
Dim jtrb As HttpJob
        jtrb.Initialize("", Me)
        jtrb.Download2("http://kccug.com/KabojjaApp/HandlerVBLoadclass.ashx",Array As String("Action", "jtr", "customerId",ResultSet1.GetString2(0)))
        Wait For (jtrb) JobDone(jtrb As HttpJob)
        If jtrb.Success Then
            Log(jtrb.GetString)
        End If
        jtrb.Release
       
        Dim jt As HttpJob
        jt.Initialize("", Me)
        jt.Download("http://kccug.com/KabojjaApp/HandlerVBDisplayload.ashx")
        'j.GetRequest.Timeout = 1000 ' 10 seconds2
        Wait For (jt) JobDone(jt As HttpJob)
        If jt.Success Then ' if job is success (http status code 200)
            Dim RetVal As String
            RetVal = jt.GetString
       
            Dim jp As JSONParser
            jp.Initialize(jt.GetString)
            'Log(jp) ' will pr
            Dim quotes As List = jp.NextArray
            For Each quot As Map In quotes
                Log("Phone: " & quot.Get("Phone"))
                Log("Type: " & quot.Get("Type"))
                Log("Class: " & quot.Get("class"))
                Log("Stream: " & quot.Get("Stream"))
                Log("Names: " & quot.Get("Names"))
                       
               
                Dim rst As ResultSet = SQL1.ExecQuery("SELECT DISTINCT ID FROM AndroidUserdata;" )
            '    Do While rs.NextRow
                Dim row(1) As Object
                   
                row(1) = rst.GetString("ID")'
                    Dim NewID As Int
                    NewID =row(1) +1
                    SQL1.ExecNonQuery2("INSERT INTO AndroidUserdata VALUES(?, ?, ?,?, ?,?)", Array As Object(quot.Get("Phone"), quot.Get("Names"), quot.Get("class") ,quot.Get("Stream"),quot.Get("Type"),NewID))
                                                               
        jt.Release

                'Loop
                Next
            'jk.Release

            'Return
        End If
 
Top