B4J Question Help, I've been studying for a whole day but haven't solved it. The data queried by B4J is different from the data in Access

guandjy

Member

B4X:
Dim req1 As DBRequestManager = CreateRequest
    Dim cmd1 As DBCommand = CreateCommand("select_tubiao3",Null)
    Wait For (req1.ExecuteQuery(cmd1, 0, Null)) JobDone(j1 As HttpJob)
    If j1.Success Then
      req1.HandleJobAsync(j1, "req1")
      Wait For (req1) req1_Result(res1 As DBResult)
       req1.PrintTable(res1)
       Dim data4 As List
          data4.Initialize
        For Each row() As Object In res1.Rows
            Dim BUMEN As String = row(res1.Columns.Get("bumena"))
            Dim YIYUE As String= row(res1.Columns.Get("一"))
            Dim ERYUE As Double = row(res1.Columns.Get("二"))
            Dim SANYUE As Double = row(res1.Columns.Get("三"))
            Dim SIYUE As Double = row(res1.Columns.Get("四"))
            Dim WUYUE As Int = row(res1.Columns.Get("五"))
        data4.Add(Array(BUMEN,YIYUE,ERYUE,SANYUE,SIYUE,WUYUE))
        
        Next
        B4XTable1.AddColumn("bumen",B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("YIYUE",B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("ERYUE",B4XTable1.COLUMN_TYPE_NUMBERS)
        B4XTable1.AddColumn("SANYUE",B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("SIYUE",B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.AddColumn("WUYUE",B4XTable1.COLUMN_TYPE_TEXT)
        B4XTable1.SetData(data4)
        B4XTable1.Refresh
    Else
        Log("ERROR: " & j1.ErrorMessage)
    End If
    j1.Release
 

guandjy

Member
I'm sure there's no problem with the code, and the queries in the ACCESS database are also displaying normally
B4X:
sql.select_tubiao3 = SELECT * FROM CHARTZHIXING
 
Upvote 0

guandjy

Member
This code is displayed correctly in ACCESS:
SELECT bumen AS bumena, round(sum(一月份实际)/IIF(SUM(一月份计划)<>0,sum(一月份计划),1),2) AS 一, round(sum(二月份实际)/IIF(SUM(二月份计划)<>0,sum(二月份计划),1),2) AS 二, round(sum(三月份实际)/IIF(SUM(三月份计划)<>0,sum(三月份计划),1),2) AS 三, round(sum(四月份实际)/IIF(SUM(四月份计划)<>0,sum(四月份计划),1),2) AS 四, round(sum(五月份实际)/IIF(SUM(五月份计划)<>0,sum(五月份计划),1),2) AS 五 FROM zhichuchaxun
GROUP BY bumen;
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…