Android Question (SOLVED) Issue with MSSQL (select query).

tigrot

Well-Known Member
Licensed User
Longtime User
Hi everybody,
I'm writing a program using a DB written on a remote server.
I had no issue with commands like insert(command only). Now I need a simple select to look for user data
and I get.

Fatto
HandleJob: 16
Tag: USER, Columns: 7, Rows: 1
id user pass level data Societa Settore
null net.sourceforge.jtds.jdbc.ClobImpl@39a2fcf6 net.sourceforge.jtds.jdbc.ClobImpl@63bfb063 net.sourceforge.jtds.jdbc.ClobImpl@68cf8c2a null net.sourceforge.jtds.jdbc.ClobImpl@4872f509 net.sourceforge.jtds.jdbc.ClobImpl@6699f5bd

The result is OK but the field content seems to be a object reference.

B4X:
Sub leggiuser
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = "readuser"
    cmd.Parameters = Array As Object(user, pass)
    reqManager.ExecuteQuery(cmd,0,"USER")
End Sub

the jobdone is

B4X:
If Job.Success = False Then
        Log("Error: " & Job.ErrorMessage)
    Else
        Log("Fatto")
        If Job.JobName = "DBRequest" Then
            Dim result As DBResult = reqManager.HandleJob(Job)
            reqManager.PrintTable(result)
            If result.Tag = "USER" Then 'query tag
               If result.Rows.Size=0 Then
                  Msgbox("Utente inesistente", "Login Utente") 
                  Job.Release    
                  Return
               End If
               For Each riga() As Object In result.Rows
                    societa = riga(5)
                    settore = riga(6)
                    Log(societa)
                    Log(settore)
               Next
            End If   
          End If
     End If
    Job.Release
End Sub

The query is : sql.readuser=select * from accesso where [user]=? and pass=?

Best regards

Mauro Zanin
 
Top