How to fix DT_Text and DT_NText Read Only in Script Component
I have a script component that I have written and works as long as the Output columns on the script are string types. When I change the output column type to text (since the size could be essentially unlimited) it gives an error in the script component that the property is read only. Here is the code line that fails with Property Payments is read only. Output0Buffer.Payments = fieldValues(i) If I change the column payments to DT_Wstr it works without issue, but I want to use text incase the value is large. Here is the error if you try to run the actual script even though I know it has an error. TITLE: Package Validation Error------------------------------ Package Validation Error ------------------------------ADDITIONAL INFORMATION: Error at Data Flow Task [Script Component [85]]: Error 30526: Property 'Payments' is 'ReadOnly'.Line 86 Column 13 through 69Error 30526: Property 'Ops' is 'ReadOnly'.Line 155 Column 13 through 65 Error at Data Flow Task [Script Component [85]]: Error 30526: Property 'Payments' is 'ReadOnly'.Line 86 Column 13 through 69Error 30526: Property 'Ops' is 'ReadOnly'.Line 155 Column 13 through 65 Error at Data Flow Task [DTS.Pipeline]: "component "Script Component" (85)" failed validation and returned validation status "VS_ISBROKEN". Error at Data Flow Task [DTS.Pipeline]: One or more component failed validation. Error at Data Flow Task: There were errors during task validation. (Microsoft.DataTransformationServices.VsIntegration) ------------------------------BUTTONS: OK------------------------------
November 13th, 2006 7:28pm

Try explicitly calling SetString() on the column. Any better? ThanksMark
Free Windows Admin Tool Kit Click here and download it now
November 13th, 2006 9:46pm

First things first, make sure the input column usage type is set to Read/Write.The reason it doesn't work is that Blob data types have a different interface in pipline script components.Then, to set to value to a text field (DT_TEXT or DT_NTEXT) in a pipeline script component, use AddBlobData(), as in:Imports System.Text...Output0Buffer.Payments.AddBlobData(Encoding.Unicode.GetBytes(SomeStringHere))
November 13th, 2006 10:08pm

I had just figured it out before this post.. but my code was way worse... yours works well and is clean. Thanks!
Free Windows Admin Tool Kit Click here and download it now
November 13th, 2006 11:10pm

Output0Buffer.Payments.AddBlobData(Encoding.Unicode.GetBytes(SomeStringHere)) worked perfectly. Thanks!
July 6th, 2011 5:01pm

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

Other recent topics Other recent topics