473,320 Members | 1,920 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,320 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 794

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

Similar topics

1
by: Iain | last post by:
I've a fairly complex schema which I'm trying to create a typed data set for. I've had a number of issues to date but it is sort of working (e.g. elements are not considered nullable unless...
4
by: Alfetta159 | last post by:
I've been setting up a schema with the XML Designer in VS .NET 2003. The designer lets me set up a lot of things including a complex type that contains an unnamed complex type called modified. ...
0
by: Darren Clark | last post by:
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...
1
by: Lerp | last post by:
Hi all, I have a dataset made up of 3 tables that is bound to a datalist. On the itemdataBound event I call a sub that grabs a value (an id value) from the current row being outputted, queries...
5
by: Roy Lawson | last post by:
I am having no problems connecting to a DB, creating a DataAdapter, and creating a dataset...and connecting to the data. Using the builtin data objects to do all this. My only problem now is...
2
by: Joe | last post by:
Hi I have a dataset with 3 tables and 2 relations Is there a way to when I am at 1 row to tell if there is a relation on that row ??? I have the code hardcoded but try to make it work if the #...
2
by: Joe | last post by:
Hi I am going to receive a dataset downstream and I will not know the the fields number of field relations number of relations So I have to be flexible to take unknown data and be able to...
1
by: Hexman | last post by:
Hello All, What I'm trying to do is update a child record using a parent-child relation. I want to find out if it is faster than than doing multiple selects. Anyways, I've created a dataset...
9
by: Anil Gupte | last post by:
After reading a tutorial and fiddling, I finally got this to work. I can now put two tables created with a DataTable class into a DataRelation. Phew! And it works! Dim tblSliceInfo As New...
1
by: =?Utf-8?B?cmFuZHkxMjAw?= | last post by:
I'm working in Visual Studio 2005. I'm looking at two tables in the Data Set Designer. There's a relation between the two tables that lists 7 matching columns. Works great. One of the key...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.