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

navigating relations in a typed dataset

I am trying to understand typed datasets more.... and i am stuck on a little
problem

I have created a type dataset called "News" this consists of 2 tables.
NewsTable and NewsTypes.
the news has news_id int, title string and type int
the news type table has type_id int and type_name string
There is also a relationship created which is joining on the news.type and
then newstype.type_id

In the code below i am putting in 2 rows for types... and 1 row for a news
article. Then further is the xsd file.

My question is .... how can i get the STRING value of the newstype that
relates to my news item? eg i want an easy way to get to the value "first
type"

Any help would me much appreciated.

News myNews = new News();
News.NewsTypesRow tRow;

// Add some types
tRow = myNews.NewsTypes.NewNewsTypesRow();
tRow.type_id = 1;
tRow.type_name = "first type";

tRow.type_id = 2;
tRow.type_name = "second type";

// Add some datat to the news
News.NewsTableRow nRow = myNews.NewsTable.NewNewsTableRow();
nRow.title = "news title";
nRow.type = 1;
MessageBox.Show(nRow.title.ToString());
<?xml version="1.0" encoding="utf-8"?>

<xs:schema id="News" targetNamespace="http://tempuri.org/News.xsd"
elementFormDefault="qualified" attributeFormDefault="qualified"
xmlns="http://tempuri.org/News.xsd"
xmlns:mstns="http://tempuri.org/News.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">

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

<xs:complexType>

<xs:choice maxOccurs="unbounded">

<xs:element name="NewsTable">

<xs:complexType>

<xs:sequence>

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

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

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

<xs:element minOccurs="0" />

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="NewsTypes">

<xs:complexType>

<xs:sequence>

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

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

</xs:sequence>

</xs:complexType>

</xs:element>

</xs:choice>

</xs:complexType>

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

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

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

</xs:key>

<xs:keyref name="NewsTypesNewsTable" refer="TypeKey">

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

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

</xs:keyref>

</xs:element>

</xs:schema>
Nov 16 '05 #1
0 977

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

Similar topics

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?
5
by: DraguVaso | last post by:
Hi, Something I don't understand about a Typed DataSet: When a value in the DataSet is DBNull, it throws this error: "Cannot get value because it is DBNull". But aren't Typed DataSets...
1
by: Soeren D. | last post by:
I have read how one can define tables, indices, relations etc. in .Net code in a way that allows you to run a off-line XML based ADO.NET, which is excactly what I need. I have also read about...
1
by: Nedu N | last post by:
Hi All, I am facing problem in copying content of table from a untyped dataset into to a table inside the typed dataset. I wanted to copy the data into typed dataset in order to ease the further...
2
by: BeanTownBizTalkGuru | last post by:
Trying to get some feedback. Here's the scenerio. We are processing XML data which we generated a typed dataset to represent the XML document being processed. After procesing is complete we...
1
by: Trond | last post by:
I have a class MessageController that has a method GetMessagesDataset that connects to a database SPROC. When done it returns a dataset. Then in my ASP.NET for i do this: msgController = new...
1
by: Mat | last post by:
i have create ,using vs.net, typed dataset with relations. I would like to ask if it exists a tool,which can take the xml schema of typed dataset and generate equivalent SQL queries with...
3
by: Freeon | last post by:
Hi, I am looking for a way to sort a strong typed dataset. It would seem the most straightforward way is to use a dataview. The only problem is when I use the dataview I seem to loose the strong...
1
by: Optimus | last post by:
Hi everyone, I currently develop an application in vs.net 2005 with vb.net. I was trying to use typed dataset and I've got in trouble for converting untyped dataset into Typed DataSet. I don't...
0
by: Liming | last post by:
Hi, I designed a few DataSet Tables in the typed dataset dsigner. Recently, I encountered an error saying Failed to enable constraints. One or more rows contain values violating non-null,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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.