我被困住了... :)
Windows CE (.Net Compact Framework 3.5) 代码:
Imports System.Net
Imports System.Data
Imports windowscetest.aliweb
Public Class main
Const url = "http://myip/asw/services.asmx"
Const ip = "x.x.x.x"
Const uid = "USERID"
Const pwd = "PASSWORD"
Const bib = "LIBRARY"
Dim screen As New ScreenEngine
Dim service As New services
Dim r As New Result
Private Sub main_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
screen = New ScreenEngine
screen.SetFullScreen(True)
If IsAlive() Then
With service
.Url = url
.connectionValue = New connection
With .connectionValue
.Server = ip
.User = uid
.Password = pwd
.Library = bib
End With
.PreAuthenticate = True
.Credentials = System.Net.CredentialCache.DefaultCredentials
.BeginExecute("select * from z2ooprxt where renum like '1396%'", Operation.SelectMultipleRows, New AsyncCallback(AddressOf Ended), r)
End With
Else
End If
End Sub
Private Sub main_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
screen.SetFullScreen(False)
End Sub
Private Sub Ended(ByVal e As System.IAsyncResult)
End Sub
Private Function IsAlive() As Boolean
Dim rq As HttpWebRequest
Dim rs As HttpWebResponse
Try
rq = WebRequest.Create(url)
rs = rq.GetResponse
If Not rs.StatusCode = HttpStatusCode.OK Then
Return False
End If
rs.Close()
Catch ex As Exception
Return False
End Try
Return True
End Function
End Class
Web 服务使用 OOP 对象来回答,Result
其中包含不同的东西,包括数据表。
看来e
fromEnded
是空的...如果我同步调用 web 服务一切正常。我相信它与 stateobject 有关,但我似乎找不到任何例子......
帮助?