用下面这段代码,表格死活没有值,大部分项目是正常的,我没整了。
'点击跳转到显示明细页面
Dim e As RequestEventArgs = args(0)
Dim wb As New weui
'msgbox("edit页面")
' For Each key As String In e.GetValues.Keys '可以弹出 seqno: 253514
' msgbox(key & ":" & e.GetValues(key))
' Next
If e.GetValues.ContainsKey("seqno") =True Then
'msgbox(e.GetValues("seqno")) 可以弹出
Dim str_seqno As String = e.GetValues("seqno")
'Dim PrimaryKey As Integer = e.GetValues("key")
'Dim PageURL = "List.htm?page=" & PageNumber
'If e.PostValues.Count = 0 Then '生成编辑页面
' Dim dr As DataRow = DataTables("订单").SQLFind("[_Identify]=" & PrimaryKey)
' If dr IsNot Nothing Then
' wb.AddForm("","form1","edit.htm?key=" & PrimaryKey & "&page=" & PageNumber)
Dim str4 As String = "http://10.27.1.1:8085/Service.asmx/Query?queryxml=<root><queryid>QueryReportDetail</queryid><args1>" & str_seqno & "</args1></root>"
Dim hc As New HttpClient(str4)
Dim ret As String = hc.GetData()
Dim xo As XObject = XObject.Parse(HTMLDecode(ret))
If Typeof xo("NewDataSet")("ds") Is jarray Then '如果是数组 即 有多行结果用如下代码.
With wb.AddTable("","Table1")
.head.AddRow("项目名称","检查结果","范围","标志","单位") '主表的表头
For Each ds As JToken In xo("NewDataSet")("ds")
' .body.AddRow( CStr(ds("LISITEMNAME")), CStr(ds("RESULT")),CStr(ds("RANGE")),CStr(ds("FLAG")),CStr(ds("UNIT")) )
If Typeof ds("UNIT") Is jvalue Then
msgbox(cstr(ds("LISITEMNAME")) & cstr(ds("RESULT")) & cstr(ds("RANGE")) & cstr(ds("FLAG")) & cstr(ds("UNIT")) )
.body.AddRow( ds("LISITEMNAME"),ds("RESULT"),ds("RANGE"),ds("FLAG"),ds("UNIT"))
Else
msgbox( cstr(ds("LISITEMNAME")) & cstr(ds("RESULT")) & cstr(ds("RANGE")) & cstr(ds("FLAG")) & cstr(ds("UNIT")("@xml:space='preserve'")) )
.body.AddRow( ds("LISITEMNAME"),ds("RESULT"),ds("RANGE"),ds("FLAG"),ds("UNIT")("@xml:space='preserve'")) '过滤掉中间的 <UNIT xml:space="preserve"> 解析时就报错
End If
Next
End With
Else '如果不是数组,即呆有一行结果.
With wb.AddTable("","Table1")
.head.AddRow("项目名称","检查结果","范围","标志","单位") '主表的表头
' For Each ds As JToken In xo("NewDataSet")("ds")
' .body.AddRow( CStr(ds("LISITEMNAME")), CStr(ds("RESULT")),CStr(ds("RANGE")),CStr(ds("FLAG")),CStr(ds("UNIT")) )
.body.AddRow( xo("NewDataSet")("ds")("LISITEMNAME"), xo("NewDataSet")("ds")("RESULT"),xo("NewDataSet")("ds")("RANGE"),xo("NewDataSet")("ds")("FLAG"),xo("NewDataSet")("ds")("UNIT")) ' '注意如果主表只有一项并没有明细,则这里会报错
' Next
End With
End If
End If
e.WriteString(wb.Build) '生成网页