all groups > sql server dts > november 2004 >
You're in the

sql server dts

group:

Package.Execute code no longer works in Yukon


Package.Execute code no longer works in Yukon jimd
11/23/2004 3:49:04 PM
sql server dts:
In SQL2000 I can execute a DTS package with this code just fine
DTS.Package2Class test = new DTS.Package2Class();
object pVarPersistStgOfHost = null;
test.LoadFromSQLServer("myServer",null,null,DTS.DTSSQLServerStorageFlags.DTSSQLStgFlag_UseTrustedConnection,null,null,null,"myPackage",ref
pVarPersistStgOfHost);
test.Execute();

However the LoadFromSQLServer method is no longer part of the PackageClass
in Yukon it is insead a part of the ApplicationClass which has no execute
method.

I cannot find any code samples on how to load a yukon package assign
variables and execute the package from VS 2005 beta1.

Re: Package.Execute code no longer works in Yukon Allan Mitchell
11/24/2004 6:55:21 AM
This would probably be better on the Beta NG but something like this may work. I have not tried this in a long while though
(probably B1).

Dim a As Application = New Application()

Dim events As IDTSEvents

' Method 1: Load from the file system

Dim p As Package = a.LoadPackage("c:\foo.dtsx", events)



' Method 2: load from SQL server

Dim p2 As Package = a.LoadFromSqlServer("userName", "serverName", "serverUserName", "ServerPassword", events)



' Method 3: Load from the service

Dim p3 As Package = a.LoadFromDtsServer("packagePath","serverName", events)



' Method 4: Load from an xml document

Dim p4 As Package = New Package()

Dim xmldoc As XmlDocument = New XmlDocument()

xmldoc.Load("c:\package.dtsx")

p4.LoadFromXML(xmldoc.OuterXml, events)


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


[quoted text, click to view]

Re: Package.Execute code no longer works in Yukon Allan Mitchell
11/24/2004 7:06:03 AM
This would probably be better on the Beta NG but something like this may work. I have not tried this in a long while though
(probably B1).

Dim a As Application = New Application()

Dim events As IDTSEvents

' Method 1: Load from the file system

Dim p As Package = a.LoadPackage("c:\foo.dtsx", events)



' Method 2: load from SQL server

Dim p2 As Package = a.LoadFromSqlServer("userName", "serverName", "serverUserName", "ServerPassword", events)



' Method 3: Load from the service

Dim p3 As Package = a.LoadFromDtsServer("packagePath","serverName", events)



' Method 4: Load from an xml document

Dim p4 As Package = New Package()

Dim xmldoc As XmlDocument = New XmlDocument()

xmldoc.Load("c:\package.dtsx")

p4.LoadFromXML(xmldoc.OuterXml, events)


--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.SQLIS.com - SQL Server 2005 Integration Services.
www.Konesans.com


[quoted text, click to view]



Re: Package.Execute code no longer works in Yukon jimd
11/24/2004 12:19:04 PM
Thanks for the reply and the code examples
The problem I see is that the Application Class cannot execute a package.
While the Package Class can execute, however, it cannot load the package
from SQL or DTS

I am confused why there isn't isn't a LoadFromSQLServer method on the
Package Class or a way to transfer the Package information from Application()
to Package()

thanks again for any help

[quoted text, click to view]
Re: Package.Execute code no longer works in Yukon Darren Green
11/24/2004 10:25:37 PM
In message <7C854FA5-6AC8-469C-A3FB-699CBC734C89@microsoft.com>, jimd
<jimd@discussions.microsoft.com> writes
[quoted text, click to view]

The object model is basically a new object model, so you now use the
application to load a package. You use the package class to store that
package, as loaded via the application, so why does there need to be a
load method on the package class?

Yes it is all new, and a bit of learning curve, but is there actually
something missing, or something that you cannot do?


--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org
Re: Package.Execute code no longer works in Yukon jimd
11/29/2004 1:35:13 PM
I cannot find any samples on executing a SQL 2005 package using VS 2005 .
All I found was saving the package as XML from the application and then using
the package class to load and execute that xml.

thanks again for the replies

[quoted text, click to view]
Re: Package.Execute code no longer works in Yukon jimd
11/30/2004 12:25:04 PM
Nevermind I got it. I just needed to sit back for a moment and think it over.
Just for anyone else who is interested here is the code

Package test = new Package();
IDTSEvents testagain = null;
Microsoft.SqlServer.Dts.Runtime.Application myapp = new
Microsoft.SqlServer.Dts.Runtime.Application();
test = myapp.LoadFromSqlServer("DTS_TEST", "myServer", null, null, testagain);
test.Execute();

[quoted text, click to view]
AddThis Social Bookmark Button