| 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 = FalsestrFilePath = "C:\"Set fs = CreateObject("Scripting.FileSystemObject")Set objFolder = fs.GetFolder(strFilePath)Set objFiles = objFolder.FilesFor each File in objFiles strCurFileName = strFilePath & "\" & File.Name xmlDoc.load(strCurFileName) 'Work goes here...Next'Free Resources'Set fs = NothingEndTime = Timer()LoadTime = EndTime - StartTimeMsgBox LoadTime()End FunctionThank 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 = FalsestrFilePath = "C:\"Set fs = CreateObject("Scripting.FileSystemObject")Set objFolder = fs.GetFolder(strFilePath)Set objFiles = objFolder.FilesFor each File in objFiles strCurFileName = strFilePath & "\" & File.Name xmlDoc.load(strCurFileName) 'Work goes here...Next'Free Resources'Set fs = NothingEndTime = Timer()LoadTime = EndTime - StartTimeMsgBox LoadTime()End FunctionThank you for any help.
|
 |
|
|
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 ValueThanks again for any help. Sorry for the messy page above. |
 |
|
|
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?Brett8-) |
 |
|
|
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 |
 |
|
|
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? |
 |
|
|
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 |
 |
|
|
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 NorthwindGoSELECT Customers.CustomerID, ContactName, CompanyName, Orders.CustomerID, OrderDateFROM Customers, OrdersWHERE Customers.CustomerID = Orders.CustomerID AND (Customers.CustomerID = N'ALFKI' OR Customers.CustomerID = N'XYZAA')ORDER BY Customers.CustomerIDFOR XML AUTOGO Good LuckBrett8-)Edited by - x002548 on 04/30/2003 15:45:09 |
 |
|
|
artsapimp
Starting Member
7 Posts |
Posted - 2003-04-30 : 15:52:08
|
| I will try that, thank you. |
 |
|
|
|