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

Reading XML Excel into a dataset

P: n/a
Hi

I'm still banging my head on how to import an Excel XML spreadsheet
into a dataset. The code will work for standard XML files, but not XML
files made with Excel (I get 'Specified cast is not valid' with the
xmlread statement).

What do I need to do? ... transform it perhaps? How?
Or is there a better way?

Please help... I'm getting as despirate as the Democrats in the recent
US election! Any help of any substance will do! ... for I am lost.

The code is listed below.

Many thanks!!!

Alex

----->

-- CODE I HAVE TO READ XML FILE --

Dim thisdataset As New DataSet
Dim xmlfilename As String = "myfile.xml"
Dim fsReadXml As New System.IO.FileStream (xmlfilename,
System.IO.FileMode.Open)
Create an XmlTextReader to read the file.
Dim myXmlReader As New System.Xml.XmlTextReader(fsReadXml)
' Read the XML document into the DataSet.
thisdataset.ReadXml(myXmlReader)
' Close the XmlTextReader
myXmlReader.Close()

-- Beginning of XML Excel Spreadsheet file I am reading (cut it
short)--

<?xml version="1.0"?>
<ss:Workbook xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<x:ExcelWorkbook>
Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.