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

Problem Loading XML into dataset and binding to gridview

This is a 2 part question:

Part 1:
I am accesing a web service that returns an xml string of user information. I am attempting to load the XML into an XMLDocument, save the document, load it into a dataset, and bind the dataset to a gridview.

I'm not sure if it's neccesary to save the XML file to disk, but I wanted to make sure it was well formed. It is.

No exceptions are caught during the loading and binding process, but my gridview only displays the first 2 attribute values of the parent node (the first datarow). Any ideas as to why this would happen?

Part 2:
I need to filter the data based on several attribute values in the XML file. Is this more efficient pre-dataset or post-dataset? At a high-level, how would one go about doing either?

Here is the code:

Private Sub GetMembers()
Dim tSessionId As String = Session("TimssSessionId").ToString
Dim wsTimssCustomer As New wsTimssCustomer.TIMSSCustomer
Dim xmlDocMembers As New XmlDocument
Dim oDataSet As DataSet
Dim sXMLMembersFile As String = Server.MapPath("xmldocuments/members.xml")

'Open a new call to the web service thru the web reference
Dim wsTimssCusGet As wsTimssCustomer.TIMSSCustomer = New wsTimssCustomer.TIMSSCustomer()

'Use the GetCustomers Web Service passing session id, field names, values
Dim MemberXml As String = wsTimssCusGet.GetCustomers(tSessionId, "FirstName, LastName", "Jason, Abney")

'Load the return in an XML Document
xmlDocMembers.LoadXml(MemberXml)
xmlDocMembers.Save(sXMLMembersFile)

Try
oDataSet = new DataSet
oDataSet.ReadXml(sXMLMembersFile)

'Bind it to the gridview
gvMembers.DataSource = oDataSet.Tables(0)
gvMembers.DataBind()
Catch ex As Exception
Response.Write(ex.ToString)
End Try
End Sub
Jun 17 '07 #1
6 5039
kenobewan
4,871 Expert 4TB
Welcome to TSDN. I assume both problems could be resolved through ado.net and modifying queries. HTH.
Jun 17 '07 #2
Thank you for your response. That's a little ambiguous however. Could you elaborate please?

Thank you
Jun 17 '07 #3
kenobewan
4,871 Expert 4TB
Here is an article that may help:
Programmatically using ADO.NET and XML
Jun 18 '07 #4
That has very little to do with what I am trying to accomplish. Thanks anyway.
Jun 18 '07 #5
TRScheel
638 Expert 512MB
Edited to read more into the problem...


Have you tried binding directly into the DataSet?


Also, can you post the HTML of your gridview?
Jun 18 '07 #6
I am binding directly to the dataset. Here's the code:
oDataSet = New DataSet
oDataSet.ReadXml(sXMLMembersFile)
gvMembers.DataSource = oDataSet
gvMembers.DataBind()


Here's the HTML of the gridview:
<asp:GridView ID="gvMembers" runat="server">
</asp:GridView>
Jun 18 '07 #7

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

Similar topics

1
by: Nomad | last post by:
I'm trying to load an XML document into the DOM using the ActiveXObject I've succeeded in doing this on one machine. Which shouldn't becaus I've checked for the ActiveXObject and it doesn't...
1
by: Tom Vukovich | last post by:
I'm having a problem loading an xmldocument from the web. The xml i wish to bring into the application is generated from a request to an ASP page. The following code does not work. ...
5
by: sck10 | last post by:
Hello, I have a GridView that is using the following to connect to a SQL Server 2000 stored procedure: <asp:SqlDataSource ID="dsWebDocList" SelectCommand="sp_web_WebDocument"...
0
by: Adam Sandler | last post by:
Hello, Prior to posting I looked at http://groups.google.com/group/ microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ d8d5ae243614085e/d4fd6c4a5aa56f75 ...
2
by: shadows206 | last post by:
I am using Visual studio 2003,making aspx page.Whenever I try to drag and drop the Dataset...Just-In-Time Debugging pops up and says .. "An exception 'System.ExecutionEngineException' has occured in...
2
by: =?Utf-8?B?VmFpYmhhdg==?= | last post by:
I am trying to populate dataset from gridview but it's not working . Can anyone plz tell me how to do it..
2
by: satwinder singh | last post by:
Please help me regarding how to Export the Data from DataSet or GridView into Excel sheet. Kind Regards, Satwinder singh
5
by: satyabhaskar | last post by:
hi, I want to bind the data from the Dataset to GridView When I run my code I get the error The type or namespace name 'DataRows' could not be found (are you missing...
1
by: Vidya A | last post by:
How to bind dataset to gridview in asop.net with vb using code
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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,...

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.