D
Darren Clark
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.
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());
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.
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());