Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Package.Execute code no longer works in Yukon

9 views
Skip to first unread message

jimd

unread,
Nov 23, 2004, 6:49:04 PM11/23/04
to
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.

Thanks in advance to anyone who can help with this

Allan Mitchell

unread,
Nov 24, 2004, 1:55:21 AM11/24/04
to
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


"jimd" <ji...@discussions.microsoft.com> wrote in message news:BA8B0E8D-4BE6-472E...@microsoft.com...

Allan Mitchell

unread,
Nov 24, 2004, 2:06:03 AM11/24/04
to
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


"jimd" <ji...@discussions.microsoft.com> wrote in message news:BA8B0E8D-4BE6-472E...@microsoft.com...

jimd

unread,
Nov 24, 2004, 3:19:04 PM11/24/04
to
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

Darren Green

unread,
Nov 24, 2004, 5:25:37 PM11/24/04
to
In message <7C854FA5-6AC8-469C...@microsoft.com>, jimd
<ji...@discussions.microsoft.com> writes

>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()
>

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

jimd

unread,
Nov 29, 2004, 4:35:13 PM11/29/04
to
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

jimd

unread,
Nov 30, 2004, 3:25:04 PM11/30/04
to
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();

Hui

unread,
Dec 16, 2009, 5:46:17 PM12/16/09
to
I have exactly the same scenario, could you post your solution? Thanks.

From http://www.developmentnow.com/g/103_2004_11_0_0_397979/Package-Execute-code-no-longer-works-in-Yukon.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

0 new messages