SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SMO Server object + Connection Manager in Script task


SMO Server object + Connection Manager in Script task

Author
Message
Kenneth Fisher
Kenneth Fisher
SSChampion
SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)SSChampion (12K reputation)

Group: General Forum Members
Points: 12275 Visits: 2121
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 was once offered a wizards hat but it got in the way of my dunce cap.
--------------------------------------------------------------------------------
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum







































































































































































SQLServerCentral


Search