Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

i am trying to read the xmlfile using data set the steps i followed here are

1. accessing the database and getting the datatable
2. converting datatable into xmldoucment
3. here i like read the converted xmldocument using dataset
for this i tried in

VB
dim ds as dataset
ds.readXml(xmldocument)


but i am getting errors here...


Error 1 Overload resolution failed because no accessible 'ReadXml' can be called with these arguments:
'Public Function ReadXml(fileName As String) As System.Data.XmlReadMode': Value of type 'System.Xml.XmlDocument' cannot be converted to 'String'.
'Public Function ReadXml(reader As System.IO.TextReader) As System.Data.XmlReadMode': Value of type 'System.Xml.XmlDocument' cannot be converted to 'System.IO.TextReader'.
'Public Function ReadXml(stream As System.IO.Stream) As System.Data.XmlReadMode': Value of type 'System.Xml.XmlDocument' cannot be converted to 'System.IO.Stream'.
'Public Function ReadXml(reader As System.Xml.XmlReader) As System.Data.XmlReadMode': Value of type 'System.Xml.XmlDocument' cannot be converted to 'System.Xml.XmlReader'. D:\Seshu\Ajaxsite\Handler.ashx 43 9 D:\Seshu\Ajaxsite\

anyone can tell me how to get the third step in the above.

Thanks in advance
Seshu
Posted
Updated 15-Aug-11 21:00pm
Comments
senthil sennu 16-Aug-11 2:55am    
Why you are converting from datatable to Dataset. instead you can use datatabel itself. What is the neccesity of converting Datatable to xml document and back to DataSet
ChandraRam 16-Aug-11 3:49am    
From the four possible overload functions, you can see what types are acceptable as parameters to the ReadXml function. None of those match the type of the variable "xmldocument" that you are passing as parameter.
PhilReed 16-Aug-11 3:55am    
What type is the 'xmldocument' variable?
If it is an xmlDocument type then here's your problem, dataset.readXml() does not except xmlDocument as as a valid argument.

you could try passing a filename or xmlReader instead.

The parameter xmldocument you provide is not one of the following supported types:
fileName As String
reader As System.IO.TextReader
stream As System.IO.Stream
reader As System.Xml.XmlReader


Have a look here:
http://msdn.microsoft.com/en-us/library/d6swf149.aspx#Y1026[^]


Good luck!
 
Share this answer
 
v2
That is the easiest way to read an XML file into a dataset.

VB
dim ds as dataset
ds.readXML("c:\yourxmlfile.xml")


Have a look here for more settings that you can use with Dataset.ReadXML

MSDN: Dataset.readXML[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900