473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

how to read XML from vb code and how to store that data in a dataset

Hi all,

Im working with Xml and VB, hre im facing a big problem,that-
I want read Xml file by VB code and that( read data collection) i have to put(store) in a dataset..,

I need code for this, plz send code ASPS...

Thanks,
Vivek
Dec 8 '07 #1
5 1279
Torgg
41
Have you tried using this? I think the link below will get you started.

http://msdn2.microsoft.com/en-us/lib...yd(VS.71).aspx

Torgg
Dec 12 '07 #2
this is not exactly useful, because here in code
string xmlData = "<XmlDS><table1><col1>Value1</col1></table1><table1><col1>Value2</col1></table1></XmlDS>";

directly giving whole string of the xml,
but we need to load dataset from xml ,by giving url( path in local system)

plz send needful code as require.............


Have you tried using this? I think the link below will get you started.

http://msdn2.microsoft.com/en-us/lib...yd(VS.71).aspx

Torgg
Dec 12 '07 #3
Torgg
41
I got this from techfarmer @ ITtoolbox Blogs



Expand|Select|Wrap|Line Numbers
  1.         'load xml into a dataset to use here
  2.         Dim dSet As New DataSet
  3.         Dim fs As FileStream
  4.  
  5.         'open the xml file so we can use it to fill the dataset
  6.         Try
  7.             fs = New FileStream("C:\test.xml", FileMode.Open)
  8.         Catch ex As Exception
  9.             Debug.WriteLine(e)
  10.         End Try
  11.  
  12.         'fill the dataset
  13.         Try
  14.             dSet.ReadXml(fs)
  15.         Catch ex As Exception
  16.             Debug.WriteLine(ex)
  17.         Finally
  18.             fs.Close()
  19.         End Try
I tested this code and it populated a Dataset with the xml data. Hope this helps

Torgg
Dec 12 '07 #4
hi Togg,
ur code is working,but now my task is, i need to read whole Xml and that i have to put in a String,

example Xml:
<book genre="philosophy" publicationdate="1991" ISBN="1-861001-57-6">
<title Name="The Gorgias" title/>
<author name="Plato" author/>
</book>


then Suppose 'S' is string ,i need to store xml in S as
S ="<book genre="philosophy" publicationdate="1991" ISBN="1-861001-57- 6"> <title Name="The Gorgias" title/><author name="Plato" author/></book>"

atually im using bellow code to loadxml and to find required attibute values..
Set Xml = New DOMDocument30
Xml.async = False
Xml.loadXML (S)

send me code as required......


Thanks
Dec 20 '07 #5
Plater
7,872 Expert 4TB
So what you really want is to read the entire contents of an XML file into a single string?
What do you have need for a DataSet then?
Dec 21 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: D. Shane Fowlkes | last post by:
How can I loop through the rows of a DataSet and send the "fields" to the Function as I've attempted to do in my code? Error is at "While dsLineItems.Read()" . I'm trying to construct a Sub which...
6
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
3
by: ninjamonkey | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
1
by: csgirlie | last post by:
I'm trying to store or arrange three sets of two-dimensional data into three 2xN matrices that are stored as NumPy arrays. import os # for file handling functions import numpy as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.