SSIS: Update a RecordSet passed into a VB.NET ScriptTask
- by Zambouras
What I am trying to accomplish is using this script task to continually insert into a generated RecordSet I know how to access it in the script however I do not know how to update it after my changes to the DataTable have been made.
Code is Below:
Dim EmailsToSend As New OleDb.OleDbDataAdapter
Dim EmailsToSendDt As New DataTable("EmailsToSend")
Dim CurrentEmailsToSend As New DataTable
Dim EmailsToSendRow As DataRow
EmailsToSendDt.Columns.Add("SiteMgrUserId", System.Type.GetType("System.Integer"))
EmailsToSendDt.Columns.Add("EmailAddress", System.Type.GetType("System.String"))
EmailsToSendDt.Columns.Add("EmailMessage", System.Type.GetType("System.String"))
EmailsToSendRow = EmailsToSendDt.NewRow()
EmailsToSendRow.Item("SiteMgrUserId") = siteMgrUserId
EmailsToSendRow.Item("EmailAddress") = siteMgrEmail
EmailsToSendRow.Item("EmailMessage") = EmailMessage.ToString
EmailsToSend.Fill(CurrentEmailsToSend, Dts.Variables("EmailsToSend").Value)
EmailsToSendDt.Merge(CurrentEmailsToSend, True)
Basically my goal is to create a single row in a new data table. Get the current record set, merge the results so I have my result DataTable. Now I just need to update the ReadWriteVariable for my script. Do not know if I have to do anything special or if I can just assign it directly to the DataTable I.E. Dts.Variables("EmailsToSend").Value = EmailsToSendDt
Thanks for the help in advanced.