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
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 DTS error: invalid task

Author  Topic 

artsapimp
Starting Member

7 Posts

Posted - 2003-04-30 : 14:33:41
Below is my code (chopped up) that is generating that error. What am I doing wrong?


'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()

StartTime = Timer()

'Create and initialize (Open) ADO Connection'
Set cnn = CreateObject("ADODB.Connection")

ConnectString = "Driver={SQL Server}; " & _
"Server=servername; " & _
"Database=database; " & _
"Uid=username; " & _
"Pwd=password;"

cnn.Open ConnectString

'Create MSXML 4.0 DOM Object and initialize it'
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.validateOnParse = False

strFilePath = "C:\"

Set fs = CreateObject("Scripting.FileSystemObject")

Set objFolder = fs.GetFolder(strFilePath)
Set objFiles = objFolder.Files

For each File in objFiles
strCurFileName = strFilePath & "\" & File.Name

xmlDoc.load(strCurFileName)

'Work goes here...

Next

'Free Resources'
Set fs = Nothing

EndTime = Timer()
LoadTime = EndTime - StartTime
MsgBox LoadTime()

End Function



Thank you for any help.

artsapimp
Starting Member

7 Posts

Posted - 2003-04-30 : 14:35:33
quote:

Below is my code (chopped up) that is generating that error. What am I doing wrong?


'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************

Function Main()

StartTime = Timer()

'Create and initialize (Open) ADO Connection'
Set cnn = CreateObject("ADODB.Connection")

ConnectString = "Driver={SQL Server}; " & _
"Server=servername; " & _
"Database=database; " & _
"Uid=username; " & _
"Pwd=password;"

cnn.Open ConnectString

'Create MSXML 4.0 DOM Object and initialize it'
set xmlDoc=CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.validateOnParse = False

strFilePath = "C:\"

Set fs = CreateObject("Scripting.FileSystemObject")

Set objFolder = fs.GetFolder(strFilePath)
Set objFiles = objFolder.Files

For each File in objFiles
strCurFileName = strFilePath & "\" & File.Name

xmlDoc.load(strCurFileName)

'Work goes here...

Next

'Free Resources'
Set fs = Nothing

EndTime = Timer()
LoadTime = EndTime - StartTime
MsgBox LoadTime()

End Function



Thank you for any help.





Go to Top of Page

artsapimp
Starting Member

7 Posts

Posted - 2003-04-30 : 14:36:44
Sorry, for the third time I will try to write the complete error:

Invalid Task Result Value

Thanks again for any help. Sorry for the messy page above.

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-04-30 : 14:37:31
quote:

What am I doing wrong?



Maybe using DTS?

What are you trying to do?



Brett

8-)
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-30 : 14:42:14
quote:

quote:

What am I doing wrong?



Maybe using DTS?

What are you trying to do?


X002548,
artsapimp is creating the DTS package through VB and not through the DTS designer.

artsapimp,
I'm not sure if anyone here does it that way, so I don't know if you are going to get a reply about this problem. Hopefully somebody will be able to help you though.

Tara
Go to Top of Page

artsapimp
Starting Member

7 Posts

Posted - 2003-04-30 : 15:18:41
I am using the DTS designer, but I'm adding an ActiveX control which holds the code above.

I am trying to loop through XML files and extract the nodes, node values, and node dependancies into an SQL database. I am somewhat familiar with VB so that is the route I chose.

Has anyone else done this a different way?

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-04-30 : 15:37:48
I stand corrected then.

Your question then is an ActiveX script question and not about DTS. Try running your code outside of DTS.

Tara
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2003-04-30 : 15:44:26
I've never used them, but have you looked into XML extensions of SQL Server.

In books online look up "Insert XML": Heres a snipet:


For example, this SELECT statement retrieves information from Customers and Orders table
in the Northwind database. This query specifies the AUTO mode
in the FOR XML clause:

USE Northwind
Go

SELECT Customers.CustomerID, ContactName, CompanyName,
Orders.CustomerID, OrderDate
FROM Customers, Orders
WHERE Customers.CustomerID = Orders.CustomerID
AND (Customers.CustomerID = N'ALFKI'
OR Customers.CustomerID = N'XYZAA')
ORDER BY Customers.CustomerID
FOR XML AUTO
GO


Good Luck



Brett

8-)

Edited by - x002548 on 04/30/2003 15:45:09
Go to Top of Page

artsapimp
Starting Member

7 Posts

Posted - 2003-04-30 : 15:52:08
I will try that, thank you.

Go to Top of Page
   

- Advertisement -