开发者

SSIS: Update a RecordSet passed into a VB.NET ScriptTask

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
开发者_JAVA百科    Dim EmailsToSendRow As DataRow

    EmailsToSendDt.Columns.Add("Id", 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("Id") = Id
    EmailsToSendRow.Item("EmailAddress") = Email
    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.


Here is a previous answer of mine that addresses your problem: How can I store a dataset object into a package variable of data type object?

The short answer is that you can do it just like you mentioned above, by setting the object typed variable's value to the data table variable in your script.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜