Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Adding Attributes to Root Node

Status
Not open for further replies.

jmeckley

Programmer
Joined
Jul 15, 2002
Messages
5,269
Location
US
[tt]Please set DataSet.EnforceConstraints == false before trying to edit XmlDataDocument using XML operations[/tt]

I am receiving this error when I attempt to add attributes to the root node in asp.net.
Code:
Private Sub ViewReport(ByVal Info As DataSet, ByVal xslFile As String, ByVal fPath As String)
        Dim xml As New XmlDataDocument(Info)
        Dim xsl As New Xsl.XslTransform
        Dim writer As New XmlTextWriter(fPath, System.Text.Encoding.UTF8)

        With xml.DocumentElement
            .SetAttribute("Begin", txtB.Text)
            .SetAttribute("End", txtE.Text)
            .SetAttribute("User", User.Identity.Name)
            .SetAttribute("Date", Date.Now)
        End With
        Try
            xsl.Load(xslFile)
            xsl.Transform(xml, Nothing, writer, Nothing)
            Response.Redirect(fPath, False)
        Catch ex As Exception
            Response.Write(ex.Message)
            Response.Write("<p>")
            Response.Write(ex.ToString)
        Finally
            writer.Close()
        End Try
The error occurs on the line [tt].SetAttribute("Begin", txtB.Text)[/tt].
The xml is created from a dataset consisting of 2 linked tables. I want to add attributes to the root node to display in the footer of my report.

Jason Meckley
Database Analyst
WITF
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top