Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 DTS - Invalid task result value???

Author  Topic 

jack28
Starting Member

1 Post

Posted - 2006-01-23 : 10:41:29
Hey guys Im working with DTS packages for the first time and cant seem to get a simple vbscript to work. I keep getting Invalid task result value and my XML output is blank.
Here is my code which works when run in Vb6 but doesnt work when run in the DTS package

function main()

Dim conDB
Dim rsResources
Dim strResourceQuery
Dim sXML

set conDB = CreateObject("ADODB.Connection")
set rsResources = CreateObject("ADODB.Recordset")

strResourceQuery = "SELECT * FROM ResourceDetails"

conDB.Provider = "SQLOLEDB"
conDB.ConnectionString = "User ID=sa;PWD=sa;Data Source=test;Initial Catalog=testDB"

conDB.Open
rsResources.Open strResourceQuery, conDB

sXML = "<import type=""resource"">"

rsResources.MoveFirst
Do While Not rsResources.EOF
sXML = sXML & "<resource lastname=""" & rsResources(1) & """/>"
rsResources.MoveNext
Loop

sXML = sXML & "</import>"

conDB.Close

Dim xmlMain
set xmlMain = createobject("MSXML2.DOMDocument.4.0")
xmlMain.loadXML (sXML)
xmlMain.Save ("c:\temp\resource.xml")

End function



Any help would be appreciated, thanks.
   

- Advertisement -