如何为winform文本框分配列变量

时间:2014-06-09 18:02:55

标签: vb.net winforms

有以下查询

 <WebMethod(Description:="Retrieve members of a Client List"), SoapHeader("MessageSoapHeader", direction:=SoapHeaderDirection.In)> _
    Public Function GetClientListMembers() As DataSet
        Dim RS As SqlDataReader
        RS = objApp.ConnectUser(MessageSoapHeader.UID, MessageSoapHeader.PWD, MessageSoapHeader.Campaign, MessageSoapHeader.Keyword, LocalCommon.apSOAPAdvanced)
        If objApp.ClassErrorsCount > 0 Then
            Dim NX As New Exception
            LLIB.ThrowSOAPException(objApp.Errors(1).Number, NX, objApp.DB, objApp.Errors(1).ErrorType, objApp.Errors(1).Description)
            GetClientListMembers = New DataSet
            Exit Function
        End If

        Dim Client As New SqlCommand("optinPaging", objApp.DB)
        Client.CommandType = CommandType.StoredProcedure
        AddSQLCmdParm(Client, "@Shortcode", SqlDbType.Int, "", objApp.ShortCode, 0)
        AddSQLCmdParm(Client, "@Keyword", SqlDbType.VarChar, "", objApp.Keyword, 0)

        GetClientListMembers = LLIB.GetDataSet(Client)

        LLIB.RecordRowTransfer(GetClientListMembers.Tables(0).Rows.Count, LLIB.RowTransferDirection.ToClient, objApp)
        LLIB.FunctionCount(objApp, "GetClientListMembers") 'This must be placed after the close of RS
        GetClientListMembers.Tables(0).TableName = "Cell Numbers"
        LLIB.RecordRowTransfer(GetClientListMembers.Tables(0).Rows.Count, LLIB.RowTransferDirection.ToClient, objApp)
        'Now get the email stuff
        LLIB.AddDataTable(GetClientListMembers, "Email Addresses", "SELECT EmailAddress,Keyword, dbo.fn_ToUTC(ActualOptInDate) AS ActualOptInDate FROM EmailOptins WHERE ShortCode='" & objApp.ShortCode & "' AND Keyword='" & objApp.Keyword & "' AND OptInState=2 ORDER BY EmailAddress", objApp)
        If GetClientListMembers.Tables.Count > 1 Then LLIB.RecordRowTransfer(GetClientListMembers.Tables(1).Rows.Count, LLIB.RowTransferDirection.ToClient, objApp)
        objApp.DB.Close()
    End Function

它返回的一个列是totalPages。所有行

的值都相同

我需要在表单上的textbox中显示它。文本框的名称是“pageCount”

我不知道该怎么办。

1 个答案:

答案 0 :(得分:1)

在您的客户端应用中,您可能有类似的内容

ReturnedDS = AdvServer.GetClientListMembers()

假设您的数据库[存储过程]调用只返回一个表

dim pgCount as integer = 0 'default value
' Check if your table actually has rows
If ReturnedDS.Tables(0).Rows.Count > 0 Then
    ' pick first row and specific column
    pgCount = CInt(myDataset.Tables(0).Rows(0)("totalPages"))

End If
' set text box
pageCount.Text = pgCount.ToString()