Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Re: Reading XML documents into a Dataset


Message #1 by "Alessandro Facchini" <alfacchini@l...> on Sat, 1 Feb 2003 15:14:35 +0100
Sure!

You use the name attribute in the complex type that correspond at the table:

<xsd:element name="titleauthors" type="titleauthor"
sql:relation="titleauthor" sql:relationship="titles_titleauthor"/>

In the sql:relation tag you specify the real name of the table in the
database.

The same you can with the fields:

<xsd:element name="myIDTitle" type="xsd:string" sql:field="title_Id"/>

Hi,

Alessandro Facchini
Italy

Excuse me for my imperfect English


----- Original Message -----
From: "uday shetgeri" <ushetgeri@y...>
To: "ASPX_Professional" <aspx_professional@p...>
Sent: Thursday, January 30, 2003 6:15 PM
Subject: [aspx_professional] Reading XML documents into a Dataset


> I am trying to read an XML document into a dataset and then display the
> values in a datagrid in a webform.
>
> Here is the code snippet that I used with VB.Net/VS.Net
>
>         myDataset = New DataSet()
>         myDataset.ReadXmlSchema(Server.MapPath("AuthorSchema.xsd"))
>         myDataset.ReadXml(Server.MapPath("Authors.xml"))
>         DataGrid1.DataSource = myDataset.Tables("authors").DefaultView
>         DataGrid1.DataBind()
>
> All I get is the column headers that are the tags in the XML document.
>
> The problem could be the table "authors" in the dataset that I am trying
> to use while I am assigning the datasource to the datagrid. Typically
> when one reads from an SQL adapter one gives a name to the table when
> filling the dataset. Is there a way to assign the name to the table when
> I call the ReadXml method.
>
> Both Authors.Xml and AuthorSchema.xsd exist and the document is valid as
> per the schema.
>
> Thanks in advance for any help.
>
> regards


  Return to Index