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)
 Setting GV from .NET code

Author  Topic 

lsharpe
Starting Member

1 Post

Posted - 2004-03-30 : 10:48:30
I have set up a DTS package on SQL2000 that has 2 GlobalVariables, one defined as a string and the other as and Integer. From a .NET application I'm wanting to set the values prior to executing the package. I'm setting the value by searching thru the GV collection and when I find the appropriate pre-defined GV,setting the value with
odtsPackage.GlobalVariable(3).Value = CInt(LoadReseller)
odtsPackage.GlobalVariable(4).Value = ResellerFileName.ToString

The Integer is is working correctly, but everytime I set the value of the string GV I get the following error:

Step Error Source: Microsoft Data Transformation Services (DTS) Package
Step Error Description:Error Code: 0
Error Source= Microsoft VBScript runtime error
Error Description: Invalid procedure call or argument

Error on Line 5
(mscorlib (80004005): Missing parameter does not have a default value.
Parameter name: parameters)
Step Error code: 800403FE
Step Error Help File:sqldts80.hlp
Step Error Help Context ID:1100


Any ideas what I'm doing wrong?

drgrieve
Starting Member

1 Post

Posted - 2005-02-22 : 20:02:43
String Global variables need to be removed and readded.
A clip of my code.

'Bug in DTS when calling from VB.NET, Global variables that are strings must be removed and readded
oDTS.GlobalVariables.Remove("FileLocation")
oDTS.GlobalVariables.Remove("DBServer")
oDTS.GlobalVariables.AddGlobalVariable("FileLocation", ConfigurationSettings.AppSettings("TRSUploadNetworkLocation") & "TRS_DTS_Import.xls")
oDTS.GlobalVariables.AddGlobalVariable("DBServer", ConfigurationSettings.AppSettings("DBServer"))
Go to Top of Page
   

- Advertisement -