Representing Related Data within a DataGrid

A

Aaron

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
 
A

Aaron

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
 
C

Cor Ligthert [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top