Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
nyy0723
Starting Member
4 Posts |
Posted - 2009-09-06 : 22:41:20
|
hi all, I use the script task to set connection by the encode xml.it can work at SSIS design environment.And it also can work at dos command line:dtexec /f "c:\PACKAGE\TEST.dtsx " /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V >>C:\LOG\test.log"But when I use the stored procedure to execute the command as bellowsp_cmdshell @dtexec_cmdit failed. I trace the script task.I found the the value is null. It seems the value is null at xmlfile. connProperty.SetValue(conn, ConnectionInfo.getConnectionString(xmlFile, conn.Name, "connectionstring"))It is so strange. Can you help me? Thanks for your help in advance.The script task is as bellow,=================================================================Imports SystemImports System.DataImports System.MathImports Microsoft.SqlServer.Dts.RuntimeImports System.IOPublic Class ScriptMain Public Sub Main() Dim env As Environment Dim xmlFile As String = env.GetEnvironmentVariable("SSISConf_BSR") Dim conns As Microsoft.SqlServer.Dts.Runtime.Connections = Dts.Connections Dim conn As Microsoft.SqlServer.Dts.Runtime.ConnectionManager = conns(0) Dim connProperty As Microsoft.SqlServer.Dts.Runtime.DtsProperty Try For Each conn In conns If (conn.CreationName = "ODBC" Or conn.CreationName = "OLEDB" Or conn.CreationName = "FTP") Then For Each connProperty In conn.Properties If connProperty.Name = "ConnectionString" Then connProperty.SetValue(conn, ConnectionInfo.getConnectionString(xmlFile, conn.Name, "connectionstring")) ElseIf connProperty.Name = "UserName" Then connProperty.SetValue(conn, ConnectionInfo.getConnectionString(xmlFile, conn.Name, "username")) ElseIf connProperty.Name = "Password" Then connProperty.SetValue(conn, ConnectionInfo.getConnectionString(xmlFile, conn.Name, "password")) End If Next End If Next conn Catch ex As Exception MsgBox(ex.Message) End Try Dts.TaskResult = Dts.Results.Success End SubEnd Class ==================================================================== |
|
|
|
|
|
|