473,394 Members | 1,750 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,394 software developers and data experts.

Binding data from XQuery to a dataset

Hi,

I have a problem of binding data from XQuery to a dataset. Here is the
program I've extracted from 4guysfromrolla.com. This program read data from
an XML file (Employees.xml) and performed XQuery from this XML file. The
program ran OK to show the XML data on the Literal control. Instead of
displaying XML data on that control, I'd like to bind XML data to a dataset
and display them on Datagrid control (not in XML data format). Please help
me to solve it !!!

My e-mail is Hi*********@bts.gov
Thanks in advance.

Hiep

================================================== ==============
(Employees.aspx)

<%@ Page Language="vb" debug="true" %>
<%@ Import Namespace="Microsoft.Xml.XQuery" %>

<script runat="server">
Sub Page_Load(sender as Object, e as EventArgs)
Dim col as New XQueryNavigatorCollection()
col.AddNavigator(Server.MapPath("Employees.xml"), "Emp")

Dim query as string
query="<Emp>{for $myNode in document(""Emp"")//Employees where
$myNode/Route=""K-22"" return $myNode}</Emp>"

Dim expr as New XQueryExpression(query)
lblXML.Text = (expr.Execute(col)).ToXml()

End sub
</script>

<html>
<body>
<xmp>
<asp:Literal runat="server" id="lblXML" />
</xmp>
</body>
</html>

================================================== =====================

(Employees.xml)

<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<Employees>
<ID>1</ID>
<LastName>Jackson</LastName>
<FirstName> Alan</FirstName>
<Phone>(703) 123-4567</Phone>
<Room>430</Room>
<Route>K-22</Route>
<Gov>1</Gov>
<Status>ND</Status>
</Employees>
<Employees>
<ID>2</ID>
<LastName>Robin</LastName>
<FirstName> Tim</FirstName>
<Phone>(703) 234-5678</Phone>
<Room>412</Room>
<Route>K-15</Route>
<Gov>0</Gov>
<Status>ND</Status>
</Employees>
<NewDataSet>
Nov 18 '05 #1
0 1249

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ann Morris | last post by:
INTRODUCTION One of the most powerful aspects of .NET and Windows Forms is data binding. Data binding is the process of associating user interface (UI) elements with a data source to generate a...
0
by: Stylus Studio | last post by:
Stylus Studio 6 XML Enterprise Edition Now Integrates with TigerLogic XDMS XQuery and Native XML Database Bedford, MA, -- Stylus Studio ( http://www.stylusstudio.com ), the industry-leading...
0
by: Stylus Studio | last post by:
DataDirect XQuery(TM) is the First Embeddable Component for XQuery That is Modeled after the XQuery API for Java(TM) (XQJ) BEDFORD, Mass.--Sept. 20, 2005--DataDirect Technologies...
6
by: Omar | last post by:
When I try to databind my comboBox (specifically field "emplcode") to a filled dataset , the contents of the comboBox displays a bunch of "System.Data.DataRowView". I assume the amount of times...
13
by: Paul Slavin | last post by:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this?? any answers appreciated, as to due to the underlying...
4
by: bardo | last post by:
Does anyone knwo how I can bind a textbox to a single dataset/dataTable row? The following will give me only a Column: textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text",...
5
by: Jason Huang | last post by:
Hi, Is it possible to bind DataReader to a DataGrid in C# windows form? And how? And can we update data in a DataSet by using the DataReader? Thanks for help. Jason
3
by: Lloyd Sheen | last post by:
I am having trouble with an app that does the following: 1. Query SQL Server and return one row 2. Bind the columns to text boxes 3. User updates info 4. User clicks update button ...
2
by: Andrew Robinson | last post by:
Is there any way to accomplish two way data binding in a Details View with a DataSet or DataTable as the DataSource. All I want is to get an updated DataSet or DataTable back from the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.