脚本任务将xml文件加载到数据库表 [英] script task to load xml file to database table

查看:103
本文介绍了脚本任务将xml文件加载到数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想用脚本任务将xml文件加载到数据库。我得到了用于脚本组件的下面的代码。可以使用脚本任务做同样的事情吗?我想动态加载多个文件。在下面的代码中,它正在加载特定的文件。



Hi all,
I want to load xml file to database using script task.I got bellow code which is for script component.Can do the same thing using script task? And I want to load multiple files dynamically.In bellow code it is loading particular file.

Public Overrides Sub PreExecute()

        MyBase.PreExecute()

        'Provide the path to read the XML file and load the xml document


        xDoc.Load("file path")
    End Sub

    Public Overrides Sub CreateNewOutputRows()

        For Each xNode As XmlNode In xDoc.SelectNodes("//InvoiceDetails")


            Me.Output0Buffer.AddRow()

            Me.Output0Buffer.ID = xNode.ChildNodes(0).InnerText
            Me.Output0Buffer.Qty = xNode.ChildNodes(1).InnerText
            Me.Output0Buffer.Price = xNode.ChildNodes(2).InnerText
            Me.Output0Buffer.customer = xNode.ChildNodes(3).InnerText
            Me.Output0Buffer.DateReceived = xNode.ChildNodes(4).InnerText
            Me.Output0Buffer.Tax = xNode.ChildNodes(5).InnerText
            Me.Output0Buffer.Charges = xNode.ChildNodes(6).InnerText
            Me.Output0Buffer.Measure = xNode.ChildNodes(7).InnerText
            Me.Output0Buffer.Comments = xNode.ChildNodes(8).InnerText
            Me.Output0Buffer.Desc = xNode.ChildNodes(9).InnerText


   End Sub

    Public Overrides Sub PostExecute()
        MyBase.PostExecute()

    End Sub
End Class





任何人都可以帮助我。

谢谢



Can anybody help me.
Thanks

推荐答案

查看以下网址



http://msdn.microsoft.com/en-us/library/ms403358.aspx#example3 [ ^ ]


这篇关于脚本任务将xml文件加载到数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆