using dataset writexml to update data and losing formatting

R

Randall Arnold

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,057
Messages
2,570,443
Members
47,115
Latest member
DorothyLus

Latest Threads

Top