By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,611 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,611 IT Pros & Developers. It's quick & easy.

using dataset writexml to update data and losing formatting

P: n/a
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 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 =
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)
' Populate our DataSet object
objDA = New Data.OleDb.OleDbDataAdapter(cmd)
objDS = New Data.DataSet("dataroot")
' Rename table to match our XSL file
objDS.Tables(0).TableName = "ASOQAMetricMatrixPerformance_View"
' Output data as XML to our file
End Sub
Here is the original xml header info as provided by Microsoft Access:

<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata"
xsi:noNamespaceSchemaLocation="ASOQAMetricMatrixPe rformance_Report.xsd"
Here is the xml header as it appears after using the dataset to update the

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

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 using vb code?

Thanks to anyone able and willing to help,

Randall Arnold
Dec 22 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.