473,403 Members | 2,338 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,403 software developers and data experts.

Strongly typed dataset for hierarchical data

Hi all,

I'm trying to create a simple XML structure for storing tree-stryle data for
a forum-like software, e.g. each post will have a body field, the ID of the
user who posted the message, and zero or more subposts(replies). Thus it
would allow for unlimited depth of subposts.

I also need a simple table to store UserID, Full Name, etc of the users
posting messages.

I've created a schema in VS.NET 2003 as follows. However, now I need to add
a relation between ID field of User table and UserID field of Post table
(one-to-many). If I try to add such relation, I get "Failed to add data
relation. Exception has been thrown by the target of an invocation."

Any help is greatly appreciated.

----------------------
<?xml version="1.0" encoding="utf-8" ?>

<xs:schema id="DsPost" targetNamespace="http://tempuri.org/DsPost.xsd"
elementFormDefault="qualified"

attributeFormDefault="qualified" xmlns="http://tempuri.org/DsPost.xsd"
xmlns:mstns="http://tempuri.org/DsPost.xsd"

xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<xs:element name="DsPost" msdata:IsDataSet="true">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element name="Post">

<xs:complexType>

<xs:sequence>

<xs:element name="Body" type="xs:string" minOccurs="0" />

<xs:element name="UserID" type="xs:int" minOccurs="0" />

<xs:element name="Post" type="PostType" minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="User">

<xs:complexType>

<xs:sequence>

<xs:element name="ID" type="xs:int" minOccurs="0" />

<xs:element name="Name" type="xs:string" minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

<xs:key name="DsPostKey1" msdata:PrimaryKey="true">

<xs:selector xpath=".//mstns:User" />

<xs:field xpath="mstns:ID" />

</xs:key>

</xs:element>

<xs:complexType name="PostType">

<xs:sequence>

<xs:element name="Body" type="xs:string" minOccurs="0" />

<xs:element name="UserID" type="xs:int" minOccurs="0" />

<xs:element name="Post" type="PostType" minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:schema>
Nov 12 '05 #1
1 2073

Nevermind. Once I clicked OK and Submit again, it worked. I guess there is a
bug in VS.NET.

-Oleg.

"Oleg Ogurok" <ol**@ogurok.com.ihatespammers.ireallydo.co> wrote in message
news:10*************@corp.supernews.com...
Hi all,

I'm trying to create a simple XML structure for storing tree-stryle data
for a forum-like software, e.g. each post will have a body field, the ID
of the user who posted the message, and zero or more subposts(replies).
Thus it would allow for unlimited depth of subposts.

I also need a simple table to store UserID, Full Name, etc of the users
posting messages.

I've created a schema in VS.NET 2003 as follows. However, now I need to
add a relation between ID field of User table and UserID field of Post
table (one-to-many). If I try to add such relation, I get "Failed to add
data relation. Exception has been thrown by the target of an invocation."

Any help is greatly appreciated.

----------------------
<?xml version="1.0" encoding="utf-8" ?>

<xs:schema id="DsPost" targetNamespace="http://tempuri.org/DsPost.xsd"
elementFormDefault="qualified"

attributeFormDefault="qualified" xmlns="http://tempuri.org/DsPost.xsd"
xmlns:mstns="http://tempuri.org/DsPost.xsd"

xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

<xs:element name="DsPost" msdata:IsDataSet="true">

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element name="Post">

<xs:complexType>

<xs:sequence>

<xs:element name="Body" type="xs:string" minOccurs="0" />

<xs:element name="UserID" type="xs:int" minOccurs="0" />

<xs:element name="Post" type="PostType" minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="User">

<xs:complexType>

<xs:sequence>

<xs:element name="ID" type="xs:int" minOccurs="0" />

<xs:element name="Name" type="xs:string" minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

<xs:key name="DsPostKey1" msdata:PrimaryKey="true">

<xs:selector xpath=".//mstns:User" />

<xs:field xpath="mstns:ID" />

</xs:key>

</xs:element>

<xs:complexType name="PostType">

<xs:sequence>

<xs:element name="Body" type="xs:string" minOccurs="0" />

<xs:element name="UserID" type="xs:int" minOccurs="0" />

<xs:element name="Post" type="PostType" minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:schema>

Nov 12 '05 #2

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

Similar topics

1
by: David | last post by:
Can you convert a strongly typed dataset to another typed dataset if the schemas are identical? Thanks in advance for any insight. David.
2
by: theWizK | last post by:
Hello all. I have noticed that when I generate a strongly-typed dataset from an xml schema that the DataTables that are generated have their constructors marked as internal. What this means is...
1
by: Job Lot | last post by:
I am confused how strongly typed dataset is different from un-typed dataset. Is there any good link explaining pros and cons of both? Which one should be used preferably?
2
by: David | last post by:
I have been developing applications with Java for quite a while but I am new to .NET development. I am trying to learn the ".NET way" of creating Strongly Typed Objects from a database. The...
1
by: HardBap | last post by:
I've created a strongly typed DataSet (Customers.xsd) using the xsd.exe tool. I want to be able to access fields using ds.Customer.CompanyName. The problem is when I return this DataSet from a...
1
by: Andre Ranieri | last post by:
I'm designing an extranet web site that customers will use to log in and see their account history, make payments against their balance, etc. I've declared a strongly typed DataSet as a public...
5
by: moondaddy | last post by:
I'm caching a dataset in an asp.net session variable to hold a user's data. one data item I need to store is an image the user uploaded. My problem is that I don't know how to get the image into...
1
by: PeterH | last post by:
I am developing a web service in VB.Net that returns data from a server. I have an .asmx page that uses a strongly typed dataset and I would like to return data in the form of strongly typed data...
1
by: Code Monkey | last post by:
Silly question maybe, but I've been doing the following for far too long now: public static DataTable myDataTable() { string sql = @"SELECT column1, column2, column3, column4 FROM...
4
by: Rachana | last post by:
Hi, I have understood Data Sets but what is meant by typed/untyped/ strongly typed datasets. Can any one explain me or suggest any site/ article, to get these concepts (and their ...
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?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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,...

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.