0

抱歉,我已经有一段时间没有使用 MS Web 服务客户端了。我正在使用 web developer 2010。我创建了一个返回的 web 方法:

-<NewDataSet xmlns=""> -<TC diffgr:id="TC1" msdata:rowOrder="0">
 <SalesN>25</SalesN> 
  <PctDiscount>0.0000</PctDiscount> 
   <SubDiscount>0.0000</SubDiscount> 
 </TC> 
<TC diffgr:id="TC2" msdata:rowOrder="1"/> 
 -<TC diffgr:id="TC3" msdata:rowOrder="2"> 
  <PctDiscount>0.0000</PctDiscount> 
   <SubDiscount>0.0000</SubDiscount> 
   <SalesT>685.89</SalesT> 
</TC>
...

我正在尝试获取 SalesN 和 SalesT 中的信息

我的 aspx 按钮单击如下所示:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Dim date1 As String
    Dim date2 As String
    Dim myString As String
    date1 = TextBox1.Text
    date2 = TextBox2.Text

    Dim myreport As New ServiceReferenceReport.wsReportEngineSoapClient
    myreport.GetSalesTotals(date1, date2)
End Sub

有人可以指点我的教程,或者刷新我的记忆吗?

我已经加载了一个数据网格,但似乎无法解析出数据元素。

4

1 回答 1

0

知道了...

    Dim date1 As String
    Dim date2 As String
    date1 = TextBox1.Text
    date2 = TextBox2.Text

    Dim returnds As New DataSet
    Dim myreport As New ServiceReferenceReport.wsReportEngineSoapClient
    returnds = myreport.GetSalesTotals(date1, date2)
    Dim i As Integer
    Dim current As String
    For i = 0 To returnds.Tables(0).Rows.Count - 1
        If IsDBNull(returnds.Tables(0).Rows(i)("SalesN")) = True Then
            current = ""
        Else
            current = CStr(returnds.Tables(0).Rows(i)("SalesN"))
            Label1.Text = current
        End If
        If IsDBNull(returnds.Tables(0).Rows(i)("SalesT")) = True Then
            current = ""
        Else
            current = CStr(returnds.Tables(0).Rows(i)("SalesT"))
            Label2.Text = current
        End If
    Next

End Sub
于 2012-10-02T21:17:14.117 回答