Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

SMO Server object + Connection Manager in Script task Expand / Collapse
Posted Friday, February 4, 2011 12:31 PM

Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, December 2, 2016 10:54 AM
Points: 3,486, Visits: 2,016
I'm trying the following script

Dim sourceConn As ServerConnection
sourceConn = DirectCast(Dts.Connections("SOURCE").AcquireConnection(Dts.Transaction), _
Dim src As New Server(sourceConn)

My connection manager is using a SQL Login with a saved password. It is an ADO.NET connection. The SERVER() requires a ServerConnection to work. I could create it with just the name of the server but then I don't have the user name or password.

I'm getting an error on the DirectCast telling me that it can't convert my connection to a ServerConnection. I can convert it to a SqlConnectionObject but can't get from there to the ServerConection. Of course the ServerConnection object has a SqlConnectionObject property that would go the other way but that doesn't help me much.

Thanks for any help

Kenneth Fisher
I strive to live in a world where a chicken can cross the road without being questioned about its motives.
For better, quicker answers on T-SQL questions, click on the following...
For better answers on performance questions, click on the following...

Link to my Blog Post -->
Post #1058954
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse