Discussion:
Package.Execute code no longer works in Yukon
(too old to reply)
jimd
2004-11-23 23:49:04 UTC
Permalink
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
2004-11-24 07:06:03 UTC
Permalink
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
Post by jimd
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
jimd
2004-11-24 20:19:04 UTC
Permalink
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
Post by Allan Mitchell
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
Post by jimd
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
Darren Green
2004-11-24 22:25:37 UTC
Permalink
Post by jimd
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
2004-11-29 21:35:13 UTC
Permalink
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
Post by Darren Green
Post by jimd
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
2004-11-30 20:25:04 UTC
Permalink
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();
Post by jimd
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
Post by Darren Green
Post by jimd
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
Allan Mitchell
2004-11-24 06:55:21 UTC
Permalink
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
Post by jimd
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
Hui
2009-12-16 22:46:17 UTC
Permalink
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.ht

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

Loading...