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
Author
Message
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 20, 2014 2:22 PM
Points: 3,466, Visits: 1,819
I'm trying the following script

Dim sourceConn As ServerConnection
sourceConn = DirectCast(Dts.Connections("SOURCE").AcquireConnection(Dts.Transaction), _
ServerConnection)
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


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...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

Link to my Blog Post --> www.SQLStudies.com
Post #1058954
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse