473,769 Members | 2,106 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_i d

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.NewsTypesR ow tRow;

// Add some types
tRow = myNews.NewsType s.NewNewsTypesR ow();
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.NewsTableR ow nRow = myNews.NewsTabl e.NewNewsTableR ow();
nRow.title = "news title";
nRow.type = 1;
MessageBox.Show (nRow.title.ToS tring());
<?xml version="1.0" encoding="utf-8"?>

<xs:schema id="News" targetNamespace ="http://tempuri.org/News.xsd"
elementFormDefa ult="qualified" attributeFormDe fault="qualifie d"
xmlns="http://tempuri.org/News.xsd"
xmlns:mstns="ht tp://tempuri.org/News.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="u rn:schemas-microsoft-com:xml-msdata">

<xs:element name="News" msdata:IsDataSe t="true">

<xs:complexType >

<xs:choice maxOccurs="unbo unded">

<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:PrimaryK ey="true">

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

<xs:field xpath="mstns:ty pe_id" />

</xs:key>

<xs:keyref name="NewsTypes NewsTable" refer="TypeKey" >

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

<xs:field xpath="mstns:ty pe" />

</xs:keyref>

</xs:element>

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

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

Similar topics

1
6089
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
7473
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 invented to make life easier, to be able to get to tge Tables and Values with less code, in less time? But with this thing you need to add a Try-Catch around every statement when using the value, add for each value a default value in your DataSet (and...
1
1120
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 Typed Dataset and hoiw this definition is stored in an XSD file. I was wondering if these two technologies can be used together or put in other words: Can I use the GUI tools in VS.Net to define the layout of my tables in order to desing my...
1
1720
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 processing using typed references. DataSet ds = getDataFromDB(); - i am getting the dataset ds from a webservice I have got MyXSD which decsribes the shcema for the table which i am getting from the webservice
2
2253
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 would like to add/update/delete the data in multiple databases. Here lies the disconnect. The XML representation is seperated from the physical model(s) in the database there for the typed datasets are drastically different. What is the best...
1
1253
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 MessagesController(); DataSet dsMessages = new Dataset(); dsMessages = msgController.GetMessagesDataset();
1
989
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 relations so that i can create tables in my sql database. Thanks u
3
2761
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 typed properties from my original dataset Anyone that can point me to an example of how to sort my dataset and maintain the use of my typed properties would be greatly appreciated Thank, Freeon
1
9362
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 know why I cannot perform this casting operation properly. First off, I've got my Typed DataSet named "AuthInfo" declared and I then created an instance of that class. What I'd like to do next is to perform querying through the method...
0
1280
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, unique, or foreign-key constraints. I didn't have any relations or non null values in the table, so I didn't know what was going on. I debugged by manually query the same
0
9589
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10216
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.