Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
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: Monday, October 5, 2015 1:36 PM
Points: 3,476, Visits: 1,898
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