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

Representing Related Data within a DataGrid

P: n/a
Hi,

It is possible to establish relationships between tables within a
dataset and this allows some useful features. For example, given a row
from a table you can use GetParentRow, GetParentRows, GetChildRows.

However, I don't see a good way to represent data from multiple dataset
tables within a single datagrid (although I can think of at least one
bad way). For example, if you have a Invoice table which instead of
having an company address, simply has a foreign key to an Address
table, but when the data is displayed in a grid, you want Invoice info
and the Address info to appear as 1 record. In the examples that I
have read, if data from multiple tables is required in this way, the
data is actually obtained by giving the SelectCommand a query that
includes the proper SQL statement with joins, etc. In this case, the
data from multiple tables is combined at the server and arrives within
the VB application as a single table. While this is useful, I would
like to see if it is possible to combine data from multiple dataset
tables.

Since the dataset approximately represents a database, what I imagine
for the solution would be some way to generate a new dataview that
would aggregate the data together based on a SQL-like statement that I
passed to a dataset method. This would also be different from writing
code that will generate a new combined table from scratch that if any
changes were made, the dataview would also be updated by changes in the
tables it was build from (I suppose you could also write code that
would update the generated table but would like to find a better way if
possible).

Also, I have noticed it is possible to set the datasource of a grid to
an entire dataset, but this does not produce the results I want.

Thank you,
Aaron

Aug 17 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Aaron,

It is possible, but don't expect to much from the result.

http://www.vb-tips.com/dbpages.aspx?...8-ddebf666ce1e

I hope this helps,

Cor

"Aaron" <od*********@hotmail.comschreef in bericht
news:11********************@i42g2000cwa.googlegrou ps.com...
Hi,

It is possible to establish relationships between tables within a
dataset and this allows some useful features. For example, given a row
from a table you can use GetParentRow, GetParentRows, GetChildRows.

However, I don't see a good way to represent data from multiple dataset
tables within a single datagrid (although I can think of at least one
bad way). For example, if you have a Invoice table which instead of
having an company address, simply has a foreign key to an Address
table, but when the data is displayed in a grid, you want Invoice info
and the Address info to appear as 1 record. In the examples that I
have read, if data from multiple tables is required in this way, the
data is actually obtained by giving the SelectCommand a query that
includes the proper SQL statement with joins, etc. In this case, the
data from multiple tables is combined at the server and arrives within
the VB application as a single table. While this is useful, I would
like to see if it is possible to combine data from multiple dataset
tables.

Since the dataset approximately represents a database, what I imagine
for the solution would be some way to generate a new dataview that
would aggregate the data together based on a SQL-like statement that I
passed to a dataset method. This would also be different from writing
code that will generate a new combined table from scratch that if any
changes were made, the dataview would also be updated by changes in the
tables it was build from (I suppose you could also write code that
would update the generated table but would like to find a better way if
possible).

Also, I have noticed it is possible to set the datasource of a grid to
an entire dataset, but this does not produce the results I want.

Thank you,
Aaron

Aug 17 '06 #2

P: n/a
Cor,

Thank you for responding. While setting a grid's datasource to a
dataset WILL allow a user to navigate the tables based on the
relationships, it does not have the capability that I was looking for.
Rather than showing the foreign key and clicking on a link to the
related data, I would like if the fk were not even shown to the user
the related data would appear in the same line of the grid.

I guess what I am looking for would be analogous to a SQL server View,
but instead of being created on the server, it would be created
entirely within the VB application with tables from a dataset.

Aaron

Aug 17 '06 #3

P: n/a
Aaron,

The same as an advice I gave to somebody else yesterday, just use two grid
above each other, it is easier for you and your enduser. I did look as well
for what you are looking for, I never saw it.

If you need a link to our website where there are samples for that reply.

I hope this helps,

Cor
"Aaron" <od*********@hotmail.comschreef in bericht
news:11**********************@i3g2000cwc.googlegro ups.com...
Cor,

Thank you for responding. While setting a grid's datasource to a
dataset WILL allow a user to navigate the tables based on the
relationships, it does not have the capability that I was looking for.
Rather than showing the foreign key and clicking on a link to the
related data, I would like if the fk were not even shown to the user
the related data would appear in the same line of the grid.

I guess what I am looking for would be analogous to a SQL server View,
but instead of being created on the server, it would be created
entirely within the VB application with tables from a dataset.

Aaron

Aug 17 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.