using dataset writexml to update data and losing formatting

Discussion in 'ASP .Net' started by Randall Arnold, Dec 22, 2005.

  1. I have a Microsoft Access report (built on a SQL Server 2000 query) I have
    exported as xml/html. I include a stylesheet in the original export for
    formatting of the report. The schema is separate. When I preview this in
    my Visual web developer Express project it looks almost perfect (VBA
    generated color formatting is missing, but that's no show-stopper). So it
    works up to here.

    For unknown reasons I cannot use the Live Data option in the Access xml
    export (error says database object cannot be found when page is loaded) so I
    have created an asp.net page in VWD that uses a dataset object to generate
    new xml from my query on Page load. This also works. HOWEVER-- the new xml
    is missing crucial stylesheet references and so all I get is a clump of data
    when the html page loads.

    I am including code and xml header info as follows:

    Private Sub UpdateFileXML()
    Dim sXMLFile As String
    Dim sADPFile As String
    Dim sConn As String
    Dim strSQL As String
    sXMLFile = MapPath("./ASOQAMetricMatrixPerformance_Report.xml")
    sADPFile =
    \\Alfil002\projects\QUALITY\Metrics/Databases\alsql003_vbsap_dev.adp
    sConn = "Provider=SQLOLEDB;Data Source=alsql003;Initial
    Catalog=VBsap;Persist Security Info=True;User ID=Dev;Password=qq"
    strSQL = "Select * From ASOQAMetricMatrixPerformance_View"
    Dim cnn As Data.OleDb.OleDbConnection
    Dim cmd As Data.OleDb.OleDbCommand
    Dim objDA As Data.OleDb.OleDbDataAdapter
    Dim objDS As Data.DataSet
    cnn = New Data.OleDb.OleDbConnection(sConn)
    cmd = New Data.OleDb.OleDbCommand(strSQL, cnn)
    cnn.Open()
    ' Populate our DataSet object
    objDA = New Data.OleDb.OleDbDataAdapter(cmd)
    objDS = New Data.DataSet("dataroot")
    objDA.Fill(objDS)
    ' Rename table to match our XSL file
    objDS.Tables(0).TableName = "ASOQAMetricMatrixPerformance_View"
    ' Output data as XML to our file
    objDS.WriteXml(sXMLFile)
    End Sub
    ---------------------------------
    Here is the original xml header info as provided by Microsoft Access:

    <?xml version="1.0" encoding="UTF-8"?>
    <dataroot xmlns:eek:d="urn:schemas-microsoft-com:eek:fficedata"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="ASOQAMetricMatrixPerformance_Report.xsd"
    generated="2005-12-22T11:11:18">
    -------------------------------------
    Here is the xml header as it appears after using the dataset to update the
    data:

    <?xml version="1.0" standalone="yes"?>
    <dataroot>
    ----------------------------------------------

    Note the missing schema info in the updated version. If I manually restore
    the missing values, the page renders properly.

    My question is: how can I programmatically restore the missing values in
    asp.net using vb code?

    Thanks to anyone able and willing to help,

    Randall Arnold
    Randall Arnold, Dec 22, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Martin
    Replies:
    2
    Views:
    1,228
    Martin
    May 25, 2004
  2. Stephen Witter

    WriteXml grouping data

    Stephen Witter, Oct 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    427
    Stephen Witter
    Oct 28, 2004
  3. Aryan
    Replies:
    0
    Views:
    474
    Aryan
    Jul 28, 2006
  4. Morten Snedker

    Problem with Dataset.WriteXML

    Morten Snedker, Aug 14, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    662
    Morten Snedker
    Aug 14, 2007
  5. Michael Persaud

    writeXML from session Dataset

    Michael Persaud, Aug 12, 2004, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    130
    Michael Persaud
    Aug 12, 2004
Loading...

Share This Page