SQL 2008 (duel Processers, 10GB Ram)
I have a dataflow script task that I am using as a data source. ( code and errors below) . If I run the task normally, I get an error
Exception from HRESULT: 0xC0010009
at Microsoft.SqlServer.Dts.Runtime.Wrapper.IDTSVariables100.get_Item(Object Index)
at SC_0f2a4d25b8134b2fa78c6f297534c16b.Variables.get_ForEachReportLicnece()
at SC_0f2a4d25b8134b2fa78c6f297534c16b.ScriptMain.PreExecute()
at Microsoft.SqlServer.Dts.Pipeline.ScriptComponentHost.PreExecute
After some head scratching, I put a message box in my script to check the 'licence' and the result was correct and there was no error, however if I take that message box our I get the error again. If I put a break point in the code, and just continue after hitting the breakpoint no error. Im at a loss as to what the problem is.
Code
Public Class ScriptMain Inherits UserComponent Dim connMgr As IDTSConnectionManager100 Dim sqlConn As SqlConnection Dim sqlCmd As SqlCommand Dim sqlParam As SqlParameter Dim sqlReader As SqlDataReader Dim RTNINT As Integer Public Overrides Sub AcquireConnections(ByVal Transaction As Object) connMgr = Me.Connections.CBFConnection sqlConn = CType(connMgr.AcquireConnection(Nothing), SqlConnection) End Sub ' 'You can remove this method if you don't need to do anything here. Public Overrides Sub PreExecute() MyBase.PreExecute() sqlCmd = New SqlCommand("sp_GetArudd_nonCBI", sqlConn) sqlCmd.CommandType = CommandType.StoredProcedure sqlParam = New SqlParameter("@ret_val", SqlDbType.Int) sqlParam.Direction = ParameterDirection.ReturnValue sqlParam.Value = RTNINT sqlCmd.Parameters.Add(sqlParam) sqlParam = New SqlParameter("@FileName", SqlDbType.NVarChar, 250) sqlParam.Direction = ParameterDirection.Input sqlParam.Value = Me.Variables.xmlFileName sqlCmd.Parameters.Add(sqlParam) sqlReader = sqlCmd.ExecuteReader End Sub ' This method is called after all the rows have passed through this component. ' ' You can delete this method if you don't need to do anything here. Public Overrides Sub PostExecute() MyBase.PostExecute() sqlReader.Close() End Sub Public Overrides Sub CreateNewOutputRows() If sqlReader.HasRows Then Dim I As Integer = 0 While sqlReader.Read If I < 1 Then HeaderBuffer.AddRow() Me.HeaderBuffer.Licence = sqlReader.GetString(sqlReader.GetOrdinal("licence")) ' MsgBox(sqlReader.GetString(sqlReader.GetOrdinal("licence"))) Me.HeaderBuffer.contentlink = sqlReader.GetString(sqlReader.GetOrdinal("contentlink")) Me.HeaderBuffer.reporttype = sqlReader.GetString(sqlReader.GetOrdinal("reporttype")) Me.HeaderBuffer.advicenumber = sqlReader.GetString(sqlReader.GetOrdinal("advicenumber")) Me.HeaderBuffer.reportproceddingdate = sqlReader.GetDateTime(sqlReader.GetOrdinal("reportproceddingdate")) Me.HeaderBuffer.reportdebitdate = sqlReader.GetDateTime(sqlReader.GetOrdinal("reportdebitdate")) Me.HeaderBuffer.username = sqlReader.GetString(sqlReader.GetOrdinal("username")) Me.HeaderBuffer.usernumber = sqlReader.GetString(sqlReader.GetOrdinal("usernumber")) Me.HeaderBuffer.accountname = sqlReader.GetString(sqlReader.GetOrdinal("accountname")) Me.HeaderBuffer.number = sqlReader.GetString(sqlReader.GetOrdinal("number")) Me.HeaderBuffer.sortcode = sqlReader.GetString(sqlReader.GetOrdinal("sortcode")) Me.HeaderBuffer.accounttype = sqlReader.GetString(sqlReader.GetOrdinal("accounttype")) Me.HeaderBuffer.bankname = sqlReader.GetString(sqlReader.GetOrdinal("bankname")) Me.HeaderBuffer.branchname = sqlReader.GetString(sqlReader.GetOrdinal("branchname")) Me.HeaderBuffer.numberofitems = sqlReader.GetInt32(sqlReader.GetOrdinal("numberofitems")) Me.HeaderBuffer.valueofitems = sqlReader.GetDecimal(sqlReader.GetOrdinal("valueofitems")) End If BodyBuffer.AddRow() Me.BodyBuffer.contentlink = sqlReader.GetString(sqlReader.GetOrdinal("contentlink")) Me.BodyBuffer.rdiref = sqlReader.GetString(sqlReader.GetOrdinal("rdiref")) Me.BodyBuffer.rditranscode = sqlReader.GetString(sqlReader.GetOrdinal("rditranscode")) Me.BodyBuffer.rdireturncode = sqlReader.GetString(sqlReader.GetOrdinal("rdireturncode")) Me.BodyBuffer.rdireturndescritpion = sqlReader.GetString(sqlReader.GetOrdinal("rdireturndescritpion")) Me.BodyBuffer.rdiorigionalprocessingdate = sqlReader.GetDateTime(sqlReader.GetOrdinal("rdiorigionalprocessingdate")) Me.BodyBuffer.rdivalueof = sqlReader.GetDecimal(sqlReader.GetOrdinal("rdivalueof")) Me.BodyBuffer.rdicurrency = sqlReader.GetString(sqlReader.GetOrdinal("rdicurrency")) Me.BodyBuffer.panumber = sqlReader.GetString(sqlReader.GetOrdinal("panumber")) Me.BodyBuffer.paref = sqlReader.GetString(sqlReader.GetOrdinal("paref")) Me.BodyBuffer.paname = sqlReader.GetString(sqlReader.GetOrdinal("paname")) Me.BodyBuffer.pasortcode = sqlReader.GetString(sqlReader.GetOrdinal("pasortcode")) Me.BodyBuffer.pabankname = sqlReader.GetString(sqlReader.GetOrdinal("pabankname")) Me.BodyBuffer.pabranchname = sqlReader.GetString(sqlReader.GetOrdinal("pabranchname")) I += 1 End While BodyBuffer.SetEndOfRowset() HeaderBuffer.SetEndOfRowset() Else ' throw error End If End Sub
Dont ask me .. i dont know