I have a function that need to accept two parameters- user and folder! I call that function from VBscript, and parameters need to be send with post method. This is the Vbscript function code from where I want to post data:
Sub loadDocument()
Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "POST",HOST
xmlhttp.send ""
End Sub
Now when i try to execute this function i getting err开发者_Go百科or message that i have syntax error! I assume that error is in this line:
Const HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User="& PC\User & "folder="&c:\foldername
How I can resolve this, how i can post two variables to this function? Thanks!
I think you cannot declare a Const variable with variable parts. Change the line to
dim userVar, folderVar, HOST
userVar = "PC\User"
folderVar = "c:\foldername"
HOST = "http://192.168.0.144/webservice13/service1.asmx/Lock?User=" & userVar & "&folder=" & folderVar
Have you made sure the PC\User
and c:\foldername
paremeters you are using when constructing your HOST
variable are propery URL Encoded?
You should also prepend an &
to any additional parameter. You have not done this with your "folder="
paramenter, which should be "&folder="
.
精彩评论