By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,022 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,022 IT Pros & Developers. It's quick & easy.

Any trick to get this to work in DataColumn of DataTable?

P: n/a
Say I have a table of companies, and a table of industries (like
automobiles, steel, computers, etc..) A company may be involved in
industries, so there's a third table- a mapping table- which just keys a
company to a specific industry. This table can have multiple rows for a
single company, since some companies can be involved in multiple industries.

Now when I display Companies in a DataGrid, I want a column that prints out
all the industries it is involved in- in a comma-separated string. So one
column's data might look like "Automobiles, Machine Tools, Aeronautics" if
there are 3 rows for that company mapping it to each of those industries.

Now the trick is, how would I accomplish this just using DataTable
expression? No real SQL, just whatever the DataColumn expression syntax has
to offer... is it possible?
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The DataColumn expression syntax is just for processing the data in that
column in that table, it isn't suited for retrieving data from other tables.
You'll have to do that in code yourself, probably after you fill your
dataset you could add a new calculated column, loop through the rows,
retrieve the industries data and synthetically create the value for the
column.

--
John Wood
Blog: http://spaces.msn.com/members/johnwood/
"MrNobody" <Mr******@discussions.microsoft.com> wrote in message
news:ED**********************************@microsof t.com...
Say I have a table of companies, and a table of industries (like
automobiles, steel, computers, etc..) A company may be involved in
industries, so there's a third table- a mapping table- which just keys a
company to a specific industry. This table can have multiple rows for a
single company, since some companies can be involved in multiple industries.
Now when I display Companies in a DataGrid, I want a column that prints out all the industries it is involved in- in a comma-separated string. So one
column's data might look like "Automobiles, Machine Tools, Aeronautics" if there are 3 rows for that company mapping it to each of those industries.

Now the trick is, how would I accomplish this just using DataTable
expression? No real SQL, just whatever the DataColumn expression syntax has to offer... is it possible?

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.