dbTalk Databases Forums  

How to set the Script Manager Database Connection String

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss How to set the Script Manager Database Connection String in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mo
 
Posts: n/a

Default How to set the Script Manager Database Connection String - 06-29-2008 , 10:33 AM






Hi,

I am using the Script manager within SSIS to execute query. Currently
I have the connection string hardcoded. How do I tie the connection
string to the DTS package Connection Manager Connections so there is
only one place to change the connection for all Script Managers within
the package?

Public Sub ExecuteQuery(ByVal sql As String)
'----Change this to the variable based on the Conenction manager
connString = "Data Source=xxxo;Initial Catalog=xx;User
ID=web;Password=web01;"
Try
sqlConn = New SqlConnection(connString)
sqlCmd = New SqlCommand(sql, sqlConn)
sqlConn.Open()
sqlCmd.ExecuteNonQuery()
''SaveTextToFile(DateTime.Now.ToString() + "-" + sql,
SuccessLogFile)
Catch ex As Exception
SaveTextToFile(DateTime.Now.ToString() + "-
UpdateI.Dtsx>>", ErrorLogFile)
SaveTextToFile(ex.Message, ErrorLogFile)
SaveTextToFile(sql, ErrorLogFile)
End Try
sqlConn.Close()
End Sub

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.