views:

119

answers:

1

i am using following code to convert xml file to datatable but its just creating multiple tables (but without data) and i want tables with data..

Dim myDS As New DataSet
    Dim xmlStream As System.IO.StreamReader = New System.IO.StreamReader(Server.MapPath("~\xmldoc\result_availhotel.xml"))
    myDS.ReadXmlSchema(xmlStream)
    Response.Write(myDS.Tables.Count)
+2  A: 

ReadXmlSchema only reads the Schema (structure) not the data. Use ReadXml instead.

rdkleine
thanks for help...
Rajesh Rolen- DotNet Developer
+1. One more tip from MSDN:If you call ReadXml to load a very large file, you may encounter slow performance. To ensure best performance for ReadXml, on a large file, call the BeginLoadData method for each table in the DataSet, and then call ReadXml. Finally, call EndLoadData for each table in the DataSet, as shown in the following example. 'dataTable.BeginLoadData();dataSet.REadXml("file.xml"); dataTable.EndLoadData();'
Aseem Gautam