1
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Type DBResult (Tag As Object, **Columns As Map**, Rows As List)
Type DBCommand (Name As String, Parameters() As Object)
Private const rdcLink As String = "http://192.168.8.100:17178/rdc"
End Sub

这是进程全局变量的方法。此处列 As Map已初始化。然而,下面代码中加粗的行给出了一个错误,“对象转换为字符串。这可能是一个编程错误。(警告 #7)”

Sub GetRecord
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("selectAllNames", Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
    req.HandleJobAsync(j, "req")
    Wait For (req) req_Result(res As DBResult)
    'work with result
    'req.PrintTable(res)
    ***Log(res.Columns)***
    ListViewListTable.Clear
    For Each row() As Object In res.Rows
        Dim oBitMap As Bitmap
        Dim buffer() As Byte
        buffer = row(res.Columns.Get("gambar"))
        oBitMap = req.BytesToImage(buffer)
        ListViewListTable.AddTwoLinesAndBitmap(row(1), "See more...", oBitMap)
    Next
Else
    Log("ERROR: " & j.ErrorMessage)
End If
j.Release
End Sub

那么我应该怎么做才能消除错误呢?

4

1 回答 1

0

如果列是地图?(它看起来是什么?)。

然后要显示列,您可以使用它:

For Each MyKey As String in res.Columns.Keys
   log("Key name = " & MyKey)
   log("Key value = " & res.Columns.Get(MyKey))
Next
于 2021-04-03T18:09:07.923 回答