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 |