dbTalk Databases Forums  

Re: object in GlobalVariable 'gstrDiv' could not be persisted...?

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Re: object in GlobalVariable 'gstrDiv' could not be persisted...? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: object in GlobalVariable 'gstrDiv' could not be persisted...? - 09-18-2004 , 05:40 AM






In article <6D7E86F0-FFE5-4642-A04A-F0F7F79994AF (AT) microsoft (DOT) com>, Dwaine wrote:
Quote:
I'm working on a winform DTS package editor (VB.NET 2003, .NET1.1) to allow
bulk renaming, changing/adding properties, etc. against SQL2000.

After loading a package...
goPackage.LoadFromSQLServer(DBServerName, , ,
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, , , ,
OldPkgName, )

adding a previously non-existant global variable...
Dim oGlobal As DTS.GlobalVariable
oGlobal = goPackage.GlobalVariables.New("gstrDiv")
oGlobal.Value = "SFX"
goPackage.GlobalVariables.Add(oGlobal)
oGlobal = Nothing

and then trying to save under a new name...
goPackage.SaveToSQLServerAs(NewPkgName, DBServerName, "", "",
DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrus tedConnection, , , , , )

I get the following error....
"The object in GlobalVariable 'gstrDiv' could not be persisted. It should be
dynamically added to and removed from the GlobalVariables collection during
Package execution. No such interface supported"

Any Ideas?

This works for me.

DTS.Package2Class pkg = new DTS.Package2Class();
Object obj;
obj = null;


pkg.LoadFromSQLServer("(local)","","",DTS.DTSSQLSe rverStorageFlags.DTSSQLStgFla
g_UseTrustedConnection,"","","","Package1",ref obj);


pkg.GlobalVariables.AddGlobalVariable("MyGlobalVar iable","MyValue");


pkg.SaveToSQLServerAs("Package2","(local)","","",D TS.DTSSQLServerStorageFlags.D
TSSQLStgFlag_UseTrustedConnection,"","","",ref obj,false);


pkg.UnInitialize();


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.