I have been able to limit the number of data to send to the application however I need help setting up the application to show the fetch next button.

data retrieval code - I am using show only 2 rows because I have a small amount of data in the test database

 <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)
    RS.Close()
    If objApp.ClassErrorsCount > 0 Then
        objApp.DB.Close()
        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
    LLIB.FunctionCount(objApp, "GetClientListMembers") 'This must be placed after the close of RS

    GetClientListMembers = LLIB.GetDataSet("SELECT CellNumber,Carrier,Keyword, dbo.fn_ToUTC(ActualOptInDate) AS ActualOptInDate FROM Optins WHERE ShortCode='" & objApp.ShortCode & "' AND Keyword='" & objApp.Keyword & "' AND OptInState=2 ORDER BY CellNumber ASC Offset 2 ROWS FETCH NEXT 2 ROWS ONLY", objApp)
    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

The user view (where I need to add the 'next' link is

  Private Sub DisplayDS(ByRef ThisDS As DataSet, ByVal tblNumber As Integer)
    Dim i As Integer
    Me.txtDisplay.Text = ThisDS.ToString
    Me.comboDSTables.Items.Clear()
    For i = 0 To ThisDS.Tables.Count - 1
        Me.comboDSTables.Items.Add(i.ToString & "_" & ThisDS.Tables(i).TableName)
    Next
    Me.comboDSTables.SelectedIndex = tblNumber
    Me.lblNumberOfTables.Text = ThisDS.Tables.Count
    Dim myBindingSource As BindingSource = New BindingSource
    myBindingSource.DataSource = ThisDS.Tables(tblNumber)
    Me.AdvDataGrid.DataSource = myBindingSource
End Sub

The 'click' or button code is

    'Private Sub cmdDeleteSLMembersDifferential_Click(sender As Object, e As EventArgs) Handles cmdDeleteSLMembersDifferential.Click
'    Dim xmlNodeResult As Xml.XmlNode
'    LoadHeader()
'    Try
'        xmlNodeResult = AdvServer.DeleteSendListMembersDifferential(Me.txtListName.Text, TestDB())
'    Catch SoapEx As Exception
'        MsgBox(SoapEx.Message)
'        Exit Sub
'    End Try
'    Me.txtDisplay.Text = xmlNodeResult.OuterXml
'End Sub

Private Sub cmdSendToList_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cmdSendToList.Click
    Dim xmlNodeResult As Xml.XmlNode, ThisTime As Date
    LoadHeader()
    If Me.chkDelay.Checked Then
        If IsDate(Me.txtDelayTime.Text) Then
            ThisTime = CDate(Me.txtDelayTime.Text)
            ThisTime = ThisTime.ToUniversalTime 'Input is in local time.
        Else
            MsgBox("Delay set but Delay Time is not a date")
            Exit Sub
        End If
    Else
        ThisTime = Now()
    End If
    Try
        xmlNodeResult = AdvServer.SendToSendList(Me.txtListName.Text, Me.txtMsg.Text, Me.chkDelay.Checked, ThisTime)
    Catch SoapEx As Exception
        MsgBox(SoapEx.Message)
        Exit Sub
    End Try
    Me.txtDisplay.Text = xmlNodeResult.OuterXml
End Sub

ANY help is much appreciated - I have been working on this for about a week and it is escaping me!

Thank you!

Recommended Answers

All 3 Replies

Sorry I did't get you. Do you want to fetch some data when user hits Next button? Is it web or winForm app?

Yes, and it is a winform app

I have a query that return 700 rows -
I want the first 100 returned THEN when the 'next' button is selected the next 100 is returned.
I would like to use the navigator binder but am having trouble getting it to move to pages as opposed to the individual rows

The other option that was suggested was adding 'Offset 100 ROWS FETCH NEXT 100 ROWS ONLY' to the query BUT I have not been able to figure out how to get that to work at all!

I appreciate your help

You say you haven't got the OFFSET clause in your query to work but you have another query using that exact format in your GetClientListMembers() method. Is that not working either?
To me the offset method works quite well, simply calling and displaying the next set of 100 when the button is clicked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.