\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Database and Reporting > need some more help


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
ok what im trying to do is use a soft code i made to use a template for an xml file that will be taken from the database.. here is the code for the template:
\r\n
\r\n
Code:
\r\n
        Dim fileName As String = "test.xml"\r\n        Dim xWriter As New Xml.XmlTextWriter(fileName, System.Text.Encoding.UTF8)\r\n\r\n        Dim template As DocTemplate = sessClient.GetTemplate(Me.TemplateDocID)\r\n        \' xWriter.WriteStartDocument()\r\n        xWriter.WriteStartElement(template.TemplateCD)\r\n\r\n        For Each DocItem As InterfacePackage.InterfacePackageItem In InterfacePackage.InterfacePackageItems\r\n\r\n            xWriter.WriteStartElement("Item")\r\n\r\n            For Each column As DocTemplateCol In template.Columns\r\n                xWriter.WriteStartElement(column.TemplateColumnCD)\r\n\r\n                Dim data As Object = DocItem.DataRow_.Data(column.Index)\r\n                If Not data Is Nothing Then\r\n                    xWriter.WriteString(data.ToString)\r\n                End If\r\n\r\n                xWriter.WriteEndElement()\r\n            Next\r\n\r\n            xWriter.WriteEndElement()\r\n\r\n        Next\r\n\r\n        xWriter.WriteEndElement()\r\n\r\n        \'xWriter.WriteEndDocument()\r\n        xWriter.Close()
\r\n
and here is what i have so far now:
\r\n
\r\n
\r\n
Code:
\r\n
Dim conn As SqlClient.SqlConnection = getopenconnection\r\n        Dim cmdString As String = "SELECT * FROM wpbBearing"\r\n\r\n        Dim fileName As String = "test.xml"\r\n        Dim xWriter As New Xml.XmlTextWriter(fileName, System.Text.Encoding.UTF8)\r\n\r\n        Dim da As New SqlClient.SqlDataAdapter\r\n        Dim ds As New DataSet\r\n        da.SelectCommand = New SqlClient.SqlCommand(cmdString, conn)\r\n        da.Fill(ds)\r\n\r\n        ds.WriteXml("\\\\strfddevapp\\Projects\\Tim")\r\n\r\n        Dim interfacePackage As DocManCore.InterfacePackage = DirectCast(ActionParams, DocManCore.InterfacePackage)\r\n        For Each DocItem As DocManCore.InterfacePackage.InterfacePackageItem In interfacePackage.InterfacePackageItems\r\n\r\n            For Each column As DocManCore.DocTemplateCol In docTemplate.Columns\r\n                xWriter.WriteStartElement(column.TemplateColumnCD)\r\n\r\n                Dim data As Object = DocItem.DataRow_.Data(column.Index)\r\n                If Not data Is Nothing Then\r\n                    xWriter.WriteString(data.ToString)\r\n                End If\r\n\r\n                xWriter.WriteEndElement()\r\n            Next\r\n            xWriter.WriteEndElement()\r\n\r\n        Next
\r\n
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[703752] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 04-01-2004, 07:18 AM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
Machaira\'s Avatar\r\n\r\n
\r\n \r\n Machaira\r\n Machaira is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 03-30-2004, 08:00 AM
sidewayz sidewayz is offline
Newcomer
 
Join Date: Mar 2004
Location: Ontario
Posts: 18
Default need some more help


ok what im trying to do is use a soft code i made to use a template for an xml file that will be taken from the database.. here is the code for the template:
Code:
        Dim fileName As String = "test.xml"
        Dim xWriter As New Xml.XmlTextWriter(fileName, System.Text.Encoding.UTF8)

        Dim template As DocTemplate = sessClient.GetTemplate(Me.TemplateDocID)
        ' xWriter.WriteStartDocument()
        xWriter.WriteStartElement(template.TemplateCD)

        For Each DocItem As InterfacePackage.InterfacePackageItem In InterfacePackage.InterfacePackageItems

            xWriter.WriteStartElement("Item")

            For Each column As DocTemplateCol In template.Columns
                xWriter.WriteStartElement(column.TemplateColumnCD)

                Dim data As Object = DocItem.DataRow_.Data(column.Index)
                If Not data Is Nothing Then
                    xWriter.WriteString(data.ToString)
                End If

                xWriter.WriteEndElement()
            Next

            xWriter.WriteEndElement()

        Next

        xWriter.WriteEndElement()

        'xWriter.WriteEndDocument()
        xWriter.Close()
and here is what i have so far now:

Code:
Dim conn As SqlClient.SqlConnection = getopenconnection
        Dim cmdString As String = "SELECT * FROM wpbBearing"

        Dim fileName As String = "test.xml"
        Dim xWriter As New Xml.XmlTextWriter(fileName, System.Text.Encoding.UTF8)

        Dim da As New SqlClient.SqlDataAdapter
        Dim ds As New DataSet
        da.SelectCommand = New SqlClient.SqlCommand(cmdString, conn)
        da.Fill(ds)

        ds.WriteXml("\\strfddevapp\Projects\Tim")

        Dim interfacePackage As DocManCore.InterfacePackage = DirectCast(ActionParams, DocManCore.InterfacePackage)
        For Each DocItem As DocManCore.InterfacePackage.InterfacePackageItem In interfacePackage.InterfacePackageItems

            For Each column As DocManCore.DocTemplateCol In docTemplate.Columns
                xWriter.WriteStartElement(column.TemplateColumnCD)

                Dim data As Object = DocItem.DataRow_.Data(column.Index)
                If Not data Is Nothing Then
                    xWriter.WriteString(data.ToString)
                End If

                xWriter.WriteEndElement()
            Next
            xWriter.WriteEndElement()

        Next
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->