llAuthors.authors.Rows(i) If (row("au_lname").ToString() =
state.Author) Then found = True End If i = i + 1 End
While
If (found) Then Dim cb As AsyncCallback =
state.originalCallback ' Calls the second XML Web service, because the
author is ' valid. rs.BeginReturnedStronglyTypedDS(state.Author,
cb, state) Else ' Cannot throw the exception in this function or
the XML Web ' service will hang. So, set the state argument to
the ' exception and let the End method of the chained XML Web '
service check for it. Dim ex As ArgumentException = New
ArgumentException( "Author does not exist.", "Author") Dim cb As
AsyncCallback = state.originalCallback ' Call the second XML Web
service, setting the state to an '
exception. rs.BeginReturnedStronglyTypedDS(state.Author, cb,
ex) End If End Sub
' Define the End method. <WebMethod()>
_ Public Function EndGetAuthorRoyalties(ByVal asyncResult As
_ IAsyncResult) As localhost.AuthorRoyalties ' Return the
asynchronous result from the other XML Web service. Return
remoteService.EndReturnedStronglyTypedDS(asyncResult) End
Function
End Class
' Class to wrap the callback and state
for the intermediate asynchronous ' operation. Public Class
AsyncStateChain Public originalCallback As AsyncCallback Public
originalState As Object Public Author As String End Class End
Namespace
上一页 [1] [2] |