Variables in Script Task | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Variables in Script Task

I recieve the below error when I attempt to execute a Script Component in a Data Flow Task: The collection of variables locked for read and write access is not available outside of PostExecute. This is the code I used: Imports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper Imports Microsoft.SqlServer.Dts.Runtime.Wrapper Public Class ScriptMain Inherits UserComponent Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer) Output0Buffer.AddRow() Output0Buffer.BillerId = CType(ReadWriteVariables("CustId").Value, Int32) Output0Buffer.UserAccount = CType(Row.Column0, String) Output0Buffer.UserSubAccount = CType("001", String) Output0Buffer.PaymentAmount = CType(Row.Column1, Decimal) Output0Buffer.DueDate = CType(Row.Column2, String) Output0Buffer.EmailAddress = CType(Row.Column3, String) Output0Buffer.ImportDateTime = DateTime.Now Output0Buffer.FileName = CType(ReadWriteVariables("FileName").Value, String) Output0Buffer.FileCreationDate = CType(ReadWriteVariables("FileCreateDate").Value, String) End Sub End Class I use the variables "CustId,FileName,FileCreateDate" in the ReadWriteVariables collection. Any ideas would be appreciated as to how to get around this error.

]]>