Private Sub Command1_Click()
Dim dom As New DOMDocument
Dim http As New XMLHTTP
Dim strRet As String
If Not dom.Load("c:\\CH.xml") Then MsgBox "文件不存在"
http.Open "Post", "http://172.31.132.173/u8eai/import.asp", True '指定服务器ASP
http.send dom.xml '把xml数据发送服务器端
strRet = http.responseText 'strRet:返回的xml格式的回执信息
MsgBox strRet
End Sub
The error message, in Chinese:
实时错误
完成该操作所需的数据还不可使用.
translated by google(To English):
Real-time error
The data needed to complete the operation can not be used also
(“实时错误 完成该操作所需的数据还不可使用” means “Run-time Error, data for this operation is not usable yet.”)
The problem is you’re issuing the HTTP request as asynchronous
which means the
sendmethod will return immediately even before the server responses.but before the server responses you’re asking the
responseTextvalue already. Of course this will cause the runtime error.One workaround is to issue a synchronous request, i.e. change the 3rd parameter of
http.opento False. A better method is set a handler ofhttp‘s to handle the readyStateChange event (consult the doc for detail).