Script Hanging
Hello, This is my code, is a mixture of some examples i've found ... not quite nice but i just wanted to have it working first ... But is hangs, could anybody give me a clue why Try Dim c As New OleDbConnection(Dts.Connections.Item("SDW_Trans").ConnectionString) Dim sqlCommand As New OleDbCommand( _ "SELECT COMP_NTASP_CINESA_CODE, " + _ " COMP_NTASP_CINESA_MAIL, " + _ " COMP_NTASP_CINESA_FTP_ADRESS, " + _ " COMP_NTASP_CINESA_FTP_USER, " + _ " COMP_NTASP_CINESA_FTP_PASSWORD " + _ " FROM DBO.COMPLEX WHERE COMP_ID = '" + Dts.Variables("CompId").Value.ToString() + "'", c) Dts.VariableDispenser.LockForWrite("User::MailingList") Dts.VariableDispenser.LockForWrite("User::FTPServer") Dts.VariableDispenser.LockForWrite("User::FTPUser") Dts.VariableDispenser.LockForWrite("User::FTPPassword") Dim variablesList As Variables Dts.VariableDispenser.GetVariables(variablesList) c.Open() Dim sqlResult As OleDbDataReader sqlResult = sqlCommand.ExecuteReader() While sqlResult.Read() variablesList("User::MailingList").Value = sqlResult.GetString(1) variablesList("User::FTPServer").Value = sqlResult.GetString(2) variablesList("User::FTPUser").Value = sqlResult.GetString(3) variablesList("User::FTPPassword").Value = sqlResult.GetString(4) End While sqlResult.Close() variablesList.Unlock() Dts.TaskResult = Dts.Results.Success Catch ex As Exception Dim m As String = ex.Message While Not ex.InnerException Is Nothing ex = ex.InnerException m += vbCrLf + ex.Message + " [HL]" End While Dts.Log(m, 0, Nothing) Dts.TaskResult = Dts.Results.Failure End Try
November 25th, 2010 8:02am

So what. exactly are you trying to do with your Script? To me, it looks like you are trying to run a simple SELECT statement against a Connection Manager with a single Parameter, and get 4 fields in return (not sure of the number of rows, but probably 1). Why are you rolling your own" when SSIS has just the tool for the job? Here's a thought: Why not use the Execute SQL task for this? It has all the functionality that appears to be in the script. Connect it to the Connection Manager, and put in the command: SELECT <foo> FROM <bar> WHERE <snafu> = ? Then on the Parameters page, list the one parameter (named "0"). On the main page, set the Result Set to Single Row. On the Results page, map the four Variables in ordinal position of their respective order in the dataset, and name them 0 through 3.Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
Free Windows Admin Tool Kit Click here and download it now
November 25th, 2010 9:19am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics