Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Why are these tables not adding

Reply
Thread Tools

Why are these tables not adding

 
 
=?Utf-8?B?Q2hyaXM=?=
Guest
Posts: n/a
 
      05-05-2005
Hi,
I am trying to load 3 xml files into one dataset like

dsXML.ReadXml(Server.MapPath("file1.xml")
dsXML.ReadXml(Server.MapPath("file2.xml"))
dsXML.ReadXml(Server.MapPath("file3.xml"))

I am then trying to display each files in separate datagrid

datagrid1.datasource = dsXml.tables(0)
datagrid1.datasource = dsxml.databind

datagrid2.datasource = dsXml.tables(1).columns(1).toString
datagrid2.datasource = dsxml.databind

datagrid3.datasource = dsXml.tables(2).columns(1).toString
datagrid3.datasource = dsxml.databind

I am getting the error

Cannot find table 1.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information about
the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Cannot find table 1.



Is this possible.

Thanks
 
Reply With Quote
 
 
 
 
Lucas Tam
Guest
Posts: n/a
 
      05-05-2005
"=?Utf-8?B?Q2hyaXM=?=" <> wrote in
news:0162342D-15B9-464B-8A3E-:

> I am trying to load 3 xml files into one dataset like
>
> dsXML.ReadXml(Server.MapPath("file1.xml")
> dsXML.ReadXml(Server.MapPath("file2.xml"))
> dsXML.ReadXml(Server.MapPath("file3.xml"))
>
> I am then trying to display each files in separate datagrid
>
> datagrid1.datasource = dsXml.tables(0)
> datagrid1.datasource = dsxml.databind
>
> datagrid2.datasource = dsXml.tables(1).columns(1).toString
> datagrid2.datasource = dsxml.databind
>
> datagrid3.datasource = dsXml.tables(2).columns(1).toString
> datagrid3.datasource = dsxml.databind
>
> I am getting the error
>
> Cannot find table 1.
> Description: An unhandled exception occurred during the execution of
> the current web request. Please review the stack trace for more
> information about the error and where it originated in the code.
>
> Exception Details: System.IndexOutOfRangeException: Cannot find table
> 1.


I think you're getting this error because ReadXML only creates 1 Dataset
based on one XML file. It won't create multiple tables for you. You'll
need to explicitly load each table.



--
Lucas Tam ()
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Q2hyaXM=?=
Guest
Posts: n/a
 
      05-06-2005
Hi,
Does that mean I need separate datasets?

"Lucas Tam" wrote:

> "=?Utf-8?B?Q2hyaXM=?=" <> wrote in
> news:0162342D-15B9-464B-8A3E-:
>
> > I am trying to load 3 xml files into one dataset like
> >
> > dsXML.ReadXml(Server.MapPath("file1.xml")
> > dsXML.ReadXml(Server.MapPath("file2.xml"))
> > dsXML.ReadXml(Server.MapPath("file3.xml"))
> >
> > I am then trying to display each files in separate datagrid
> >
> > datagrid1.datasource = dsXml.tables(0)
> > datagrid1.datasource = dsxml.databind
> >
> > datagrid2.datasource = dsXml.tables(1).columns(1).toString
> > datagrid2.datasource = dsxml.databind
> >
> > datagrid3.datasource = dsXml.tables(2).columns(1).toString
> > datagrid3.datasource = dsxml.databind
> >
> > I am getting the error
> >
> > Cannot find table 1.
> > Description: An unhandled exception occurred during the execution of
> > the current web request. Please review the stack trace for more
> > information about the error and where it originated in the code.
> >
> > Exception Details: System.IndexOutOfRangeException: Cannot find table
> > 1.

>
> I think you're getting this error because ReadXML only creates 1 Dataset
> based on one XML file. It won't create multiple tables for you. You'll
> need to explicitly load each table.
>
>
>
> --
> Lucas Tam ()
> Please delete "REMOVE" from the e-mail address when replying.
> http://members.ebay.com/aboutme/coolspot18/
>

 
Reply With Quote
 
Lucas Tam
Guest
Posts: n/a
 
      05-06-2005
"=?Utf-8?B?Q2hyaXM=?=" <> wrote in
news:5A7476A6-D392-4982-AA9C-:

> Hi,
> Does that mean I need separate datasets?


Yes, basically your xml only defines one dataset.

--
Lucas Tam ()
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do Not Understand why these three Files Will Not Compile KevinSimonson C++ 9 11-10-2010 10:01 PM
I don't want to use tables, how do I do these pages scmulqueen@netzero.com HTML 5 07-26-2007 12:21 AM
why why why why why Mr. SweatyFinger ASP .Net 4 12-21-2006 01:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Text after 2 tables actually appears between 2 tables ! Peter Bassett HTML 3 08-15-2003 06:46 PM



Advertisments