473,499 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read XML data from SQL 2005 table

7 New Member
Hi All,

I have SQL 2005 table with columns TypeId(int) & Description(ntext datatype).
The Description column has XML file content as value in the table.
Now i want to read the data into a dataset in VB.Net. How to do it in VB.Net. I am using Winforms and VB.Net in VS 2005.
Below i have given the xml file content.

Expand|Select|Wrap|Line Numbers
  1.  <?xml version="1.0" encoding="Windows-1252" ?> 
  2. - <SummaryPageComponent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  3. - <categories>
  4. - <anyType xsi:type="SummaryPageComponentCategory">
  5.   <CategoryName>HotfixesCategory</CategoryName> 
  6.   <CategoryType>HotfixesCategory</CategoryType> 
  7.   <ResourceIdColumnOrdinal>2</ResourceIdColumnOrdinal> 
  8. - <CategoryTable>
  9. - <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  10. - <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="categoryTable" msdata:UseCurrentLocale="true">
  11. - <xs:complexType>
  12. - <xs:choice minOccurs="0" maxOccurs="unbounded">
  13. - <xs:element name="categoryTable">
  14. - <xs:complexType>
  15. - <xs:sequence>
  16.   <xs:element name="HF_x0020_Name" type="xs:string" /> 
  17.   <xs:element name="Installation_x0020_Date" type="xs:dateTime" minOccurs="0" /> 
  18.   <xs:element name="iResourceId" type="xs:int" /> 
  19.   </xs:sequence>
  20.   </xs:complexType>
  21.   </xs:element>
  22.   </xs:choice>
  23.   </xs:complexType>
  24. - <xs:unique name="Constraint1" msdata:PrimaryKey="true">
  25.   <xs:selector xpath=".//categoryTable" /> 
  26.   <xs:field xpath="iResourceId" /> 
  27.   <xs:field xpath="HF_x0020_Name" /> 
  28.   </xs:unique>
  29.   </xs:element>
  30.   </xs:schema>
  31. - <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
  32. - <DocumentElement>
  33. - <categoryTable diffgr:id="categoryTable1" msdata:rowOrder="0">
  34.   <HF_x0020_Name>Interactions Center - Update 100145</HF_x0020_Name> 
  35.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  36.   <iResourceId>32</iResourceId> 
  37.   </categoryTable>
  38. - <categoryTable diffgr:id="categoryTable2" msdata:rowOrder="1">
  39.   <HF_x0020_Name>Interactions Center (UN100001)</HF_x0020_Name> 
  40.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  41.   <iResourceId>32</iResourceId> 
  42.   </categoryTable>
  43. - <categoryTable diffgr:id="categoryTable3" msdata:rowOrder="2">
  44.   <HF_x0020_Name>Interactions Center (UN100101)</HF_x0020_Name> 
  45.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  46.   <iResourceId>32</iResourceId> 
  47.   </categoryTable>
  48. - <categoryTable diffgr:id="categoryTable4" msdata:rowOrder="3">
  49.   <HF_x0020_Name>Interactions Center (UN100106) - UserAdmin persistency</HF_x0020_Name> 
  50.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  51.   <iResourceId>32</iResourceId> 
  52.   </categoryTable>
  53. - <categoryTable diffgr:id="categoryTable5" msdata:rowOrder="4">
  54.   <HF_x0020_Name>Interactions Center (UN100107)</HF_x0020_Name> 
  55.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  56.   <iResourceId>32</iResourceId> 
  57.   </categoryTable>
  58. - <categoryTable diffgr:id="categoryTable6" msdata:rowOrder="5">
  59.   <HF_x0020_Name>Interactions Center (UN100146)</HF_x0020_Name> 
  60.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  61.   <iResourceId>32</iResourceId> 
  62.   </categoryTable>
  63. - <categoryTable diffgr:id="categoryTable7" msdata:rowOrder="6">
  64.   <HF_x0020_Name>Interactions Center (UN100167) - Monitoring SessionController in IPC</HF_x0020_Name> 
  65.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  66.   <iResourceId>32</iResourceId> 
  67.   </categoryTable>
  68. - <categoryTable diffgr:id="categoryTable8" msdata:rowOrder="7">
  69.   <HF_x0020_Name>Interactions Center (UN100223) - syncronization issues</HF_x0020_Name> 
  70.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  71.   <iResourceId>32</iResourceId> 
  72.   </categoryTable>
  73. - <categoryTable diffgr:id="categoryTable9" msdata:rowOrder="8">
  74.   <HF_x0020_Name>Interactions Center (UN100227) - Updates installation issue</HF_x0020_Name> 
  75.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  76.   <iResourceId>32</iResourceId> 
  77.   </categoryTable>
  78. - <categoryTable diffgr:id="categoryTable10" msdata:rowOrder="9">
  79.   <HF_x0020_Name>Interactions Center (UN100235) - Incorrect stop time</HF_x0020_Name> 
  80.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  81.   <iResourceId>32</iResourceId> 
  82.   </categoryTable>
  83. - <categoryTable diffgr:id="categoryTable11" msdata:rowOrder="10">
  84.   <HF_x0020_Name>Interactions Center UN100140 - Dynamic Mappings By Switch</HF_x0020_Name> 
  85.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  86.   <iResourceId>32</iResourceId> 
  87.   </categoryTable>
  88. - <categoryTable diffgr:id="categoryTable12" msdata:rowOrder="11">
  89.   <HF_x0020_Name>Interactions Center Update 1</HF_x0020_Name> 
  90.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  91.   <iResourceId>32</iResourceId> 
  92.   </categoryTable>
  93. - <categoryTable diffgr:id="categoryTable13" msdata:rowOrder="12">
  94.   <HF_x0020_Name>Interactions Center Update 2 - batch insertions into database</HF_x0020_Name> 
  95.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  96.   <iResourceId>32</iResourceId> 
  97.   </categoryTable>
  98. - <categoryTable diffgr:id="categoryTable14" msdata:rowOrder="13">
  99.   <HF_x0020_Name>NICE Perform® Release 3.1 - Change check for audio technique</HF_x0020_Name> 
  100.   <Installation_x0020_Date>2009-03-17T00:00:00+05:30</Installation_x0020_Date> 
  101.   <iResourceId>32</iResourceId> 
  102.   </categoryTable>
  103.   </DocumentElement>
  104.   </diffgr:diffgram>
  105.   </CategoryTable>
  106. - <Headers>
  107.   <string>Name</string> 
  108.   <string>Installation Date</string> 
  109.   <string>ResourceId</string> 
  110.   </Headers>
  111.   <DisplayHeaders>true</DisplayHeaders> 
  112.   </anyType>
  113.   </categories>
  114.   <ResourceType>23</ResourceType> 
  115. - <ResourceIds>
  116.   <int>32</int> 
  117.   </ResourceIds>
  118. - <HeaderData>
  119. - <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
  120. - <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:MainDataTable="vwSummaryPageSystemResource" msdata:UseCurrentLocale="true">
  121. - <xs:complexType>
  122. - <xs:choice minOccurs="0" maxOccurs="unbounded">
  123. - <xs:element name="vwSummaryPageSystemResource">
  124. - <xs:complexType>
  125. - <xs:sequence>
  126.   <xs:element name="iResourceId" type="xs:int" /> 
  127.   <xs:element name="iSiteId" type="xs:int" /> 
  128.   <xs:element name="iResourceType" type="xs:int" minOccurs="0" /> 
  129. - <xs:element name="vcResourceName" minOccurs="0">
  130. - <xs:simpleType>
  131. - <xs:restriction base="xs:string">
  132.   <xs:maxLength value="256" /> 
  133.   </xs:restriction>
  134.   </xs:simpleType>
  135.   </xs:element>
  136. - <xs:element name="nvcHostName" minOccurs="0">
  137. - <xs:simpleType>
  138. - <xs:restriction base="xs:string">
  139.   <xs:maxLength value="256" /> 
  140.   </xs:restriction>
  141.   </xs:simpleType>
  142.   </xs:element>
  143. - <xs:element name="nvcVersion" minOccurs="0">
  144. - <xs:simpleType>
  145. - <xs:restriction base="xs:string">
  146.   <xs:maxLength value="100" /> 
  147.   </xs:restriction>
  148.   </xs:simpleType>
  149.   </xs:element>
  150.   <xs:element name="bIsGeneralInfo" type="xs:boolean" minOccurs="0" /> 
  151.   </xs:sequence>
  152.   </xs:complexType>
  153.   </xs:element>
  154.   </xs:choice>
  155.   </xs:complexType>
  156.   </xs:element>
  157.   </xs:schema>
  158. - <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
  159. - <DocumentElement>
  160. - <vwSummaryPageSystemResource diffgr:id="vwSummaryPageSystemResource1" msdata:rowOrder="0" diffgr:hasChanges="modified">
  161.   <iResourceId>32</iResourceId> 
  162.   <iSiteId>1</iSiteId> 
  163.   <iResourceType>23</iResourceType> 
  164.   <vcResourceName>NICECLS</vcResourceName> 
  165.   <nvcHostName>192.168.91.36</nvcHostName> 
  166.   <nvcVersion>9.15.614 (Update Pack 6)</nvcVersion> 
  167.   <bIsGeneralInfo>false</bIsGeneralInfo> 
  168.   </vwSummaryPageSystemResource>
  169.   </DocumentElement>
  170. - <diffgr:before>
  171. - <vwSummaryPageSystemResource diffgr:id="vwSummaryPageSystemResource1" msdata:rowOrder="0">
  172.   <iResourceId>32</iResourceId> 
  173.   <iSiteId>1</iSiteId> 
  174.   <iResourceType>23</iResourceType> 
  175.   <vcResourceName>NICECLS</vcResourceName> 
  176.   <nvcHostName>192.168.91.36</nvcHostName> 
  177.   <bIsGeneralInfo>false</bIsGeneralInfo> 
  178.   </vwSummaryPageSystemResource>
  179.   </diffgr:before>
  180.   </diffgr:diffgram>
  181.   </HeaderData>
  182.   </SummaryPageComponent>
Please help me.

Thanks

Nila
Apr 16 '09 #1
3 1795
iam_clint
1,208 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1. Dim ds as new dataset
  2. Dim xmlstr as string
  3. xmlstr = fromrecordset
  4. ds.ReadXml(xmlstr)
  5.  
This is how you make a dataset read xml.. I assume this is what you were wanting. To put a sql table into a dataset is pretty easy if thats what you were wanting
Expand|Select|Wrap|Line Numbers
  1. Dim ds as new dataset
  2. Dim dbadap as sqldataadapter
  3. dbadap = New SqlDataAdapter("Select * from countries order by country_name", DBConn)
  4. dbadap.fill(ds, "countries")
  5.  
Apr 16 '09 #2
nilaangel78
7 New Member
Hi Clint,

The content in the table is in XML format. Now i want to read this XML content and show it in the datagridview. But as the XML content has the schema i am not able read it. Can you help me.

Thanks
Nila
Apr 20 '09 #3
iam_clint
1,208 Recognized Expert Top Contributor
I answered how to read the xml content from the database put it in a dataset.. from there you can bind it to a grid view. I am unsure about schema's as i've never really worked with them or really have an understanding of what a schema does. So beyond this point I can't be too much of a help unless someone comes in here and explains the difference between xml and xml with a schema ;( sorry.
Apr 20 '09 #4

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

Similar topics

1
5876
by: rishka | last post by:
Rishka Mar 17, 5:40 am show options Newsgroups: comp.databases.oracle.tools From: "Rishka" <ris...@webmail.co.za> - Find messages by this author Date: 17 Mar 2005 05:40:45 -0800 Local:...
0
2500
by: James Hokes | last post by:
Hi All, We're using the 1.1. Framework against SQL Server 2000, and are having a strange issue where we don't get errors back from the stored procedure, i.e. the exception never gets thrown. ...
29
5768
by: pb648174 | last post by:
I have a very long transaction that runs on the same database that other users need to use for existing data. I don't care if they see data from the transaction before it is done and am only using...
18
4852
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
0
4674
by: Peter | last post by:
I am having a problem reading an Excel file that is XML based. The directory I am reading contains Excel files that can be of two types. Either generic Microsoft based or XML based. I am reading...
0
780
by: dphill | last post by:
Hello all I am a beginner .Net programmer so please forgive my ignorance. In brief, I am trying to read from xml file stored in a SQL database table’s field. This is what I used to create...
5
1915
by: troy | last post by:
Could someone please point me in the right direction on how to read in a large query with .net. I am trying to emulate a legacy database system so I don't know the upper bounds of the sql query....
7
13248
by: Igor | last post by:
1. In this topic...
6
8136
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...
1
1042
by: nilaangel78 | last post by:
Hi All, I have SQL 2005 table with columns TypeId(int) & Description(ntext datatype). The Description column has XML file content as value in the table. Now i want to read the data into a...
0
7128
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
7169
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
7385
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...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4917
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
661
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.