1
2Dim i
3Dim mystring
4Set objQueueInfo=Server.CreateObject("MSMQ.MSMQQueueInfo")
5objQueueInfo.PathName="dgg\PRIVATE$\testqueue"
6Set objQueue=objQueueInfo.Open(32,0)
7Set Msg=Server.CreateObject("MSMQ.MSMQMessage")
8Set Msg=objQueue.PeekCurrent(,,1000)
9Do While Msg is Nothing
10Set Msg=objQueue.PeekCurrent(,,1000)
11Loop
12Do While TRUE
13mystring=Msg.Body
14if StrComp(mystring,"0serverstartpreview")=1 then
15Response.Redirect "path1.asp"
16objQueue.Close
17Set objQueueInfo=Nothing
18Set objQueue=Nothing
19Set Msg=Nothing
20Exit do
21end if
22Set Msg=objQueue.PeekNext(,,1000)
23Loop
24Response.Write "服务器连接超时,请刷新再试......"
25objQueue.Close
26Set objQueueInfo=Nothing
27Set objQueue=Nothing
28Set Msg=Nothing
主要问题是这两行:mystring=Msg.Body
if StrComp(mystring,"0serverstartpreview")=1 then
我要实现WEB页和另一个应用程序互传消息。现在那个服务器上的应用程序巳把消息发了出来。我想找出内容为“0serverstartpreview”的消息,但老是提示错误:0X800A01A8,我查了一下错误是对象被请示。
不知哪里出了问题???
---------------------------------------------------------------
没用过,不过,strcomp比较相等是0,其它的情况你也得考虑,如null等
---------------------------------------------------------------
转换成二进制进行比较。
---------------------------------------------------------------
你的Msg.body接受的是二进制字节流
怎么可以与字符串比较呢!
你试试这样
if StrComp(mystring,Cbyte("0serverstartpreview"))=0 or IsNull(mystring)=true then......