July 28, 2006 at 2:28 am
Hi i have a web link that bring me to a web page, I then select a link on the page which in turn down loads a database for me, to my network drive, i would like to automate this in my DTS package but i do not know how, any help/ideas would be great.
July 30, 2006 at 7:22 pm
That's an interesting requirement. Does the URL change for the starting link? Does the URL change for the database link? Or always a static address?
July 31, 2006 at 6:39 am
You can use the MSXML.XMLHTTP object in an activexscript to read the contents of a location to an adodb.stream. You can then save the stream to a file.
Dim HTTP
Dim Stream
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
strSource = "http://myURL"
strDest = "SaveFileAs"
Set Stream = CreateObject("adodb.stream")
Set HTTP = WScript.CreateObject("Microsoft.XMLHTTP")
HTTP.open "GET", strSource, False
HTTP.send
Stream.type = adTypeBinary
Stream.open
Stream.write HTTP.responseBody
Stream.savetofile strDest, adSaveCreateOverWrite
Set Stream = nothing
Set HTTP = nothing
July 31, 2006 at 10:04 am
The URL is static and its a access database that i down load. i will try the code and let you know how i get on, am using SQL 2000, i hope it will work. thanks
August 1, 2006 at 4:01 am
Hi am having a runtime problem with the code you gave me, am getting a error on the WScript , it say object required: WScript , code 0 .
August 1, 2006 at 7:30 am
I was able to get that script working as a test. I saved it to a txt file then renamed to script.vbs. Didn't do this as a wscript.
You have to modify the URL path and the "savefileas" value.
That worked for me - make sure you give the full path name in the savefileas value.
August 1, 2006 at 7:42 am
I put the script into a ActiveX Script Task in a DTS package, and was getting a errror,
How do call the script from your DTS package ?
October 4, 2006 at 4:30 am
Hi am getting this error when i run this activex script. "invalid task result value"
Here is my script , it works fine and downloads the file but i get this error message when it complete
Function Main()
Dim HTTP
Dim Stream
Const adTypeBinary = 1
Const adSaveCreateNotExist = 1
Const adSaveCreateOverWrite = 2
strSource = "http://www.uxb.gbr.com/service/SBS.mdb"
strDest = "\\san03\con\Files\SBS\SBS.mdb"
Set Stream = CreateObject("adodb.stream")
Set HTTP = CreateObject("Microsoft.XMLHTTP")
HTTP.open "GET", strSource, False
HTTP.send
Stream.type = adTypeBinary
Stream.open
Stream.write HTTP.responseBody
Stream.savetofile strDest, adSaveCreateOverWrite
Set Stream = nothing
Set HTTP = nothing
End Function
October 4, 2006 at 6:31 am
Sorry for not responding before. Work was blocking notifications from sqlservercentral.com and only recently allowed them through.
You just need to set the return value of the function
Put Main = DTSTaskExecResult_Success just before End Function and it should get rid of the error.
October 4, 2006 at 7:00 am
hi, yes i see that my self and fixed it, No worries regards the reply. the code you gave me works fine now, many thanks.
June 22, 2008 at 8:02 pm
How to pass the user name and the password, if required by the url??
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply