Home All Groups Group Topic Archive Search About

can I write a select ..where.. against a table in a dataset?

Author
15 May 2006 7:41 PM
Rich
Hello,

I have a master and detail table in sql server.  Say the master has 10 rows
and detail has 45 rows.  I fill 2 tables in my dataset in the client app. 
When I iterate through the master table in the client app, I display the row
contents in Textboxes.  I want to display the corresponding detail data for
each row in a datagrid. 

My question is if I can pull the master and detail data and populate the
corresponding tables in the dataset in the client app only once and then
query that data in the client so that when I am at row 1 (ID = 1) in the
master table  I populate the detail data in the datagrid from the detail
table in the dataset with detail rows where ID = 1?  Or do I have to pull the
detai data from the datasource each time for each ID in the master table?

If I can query the detail data at the client app - how is this done?  I am
using VB2005.  Can we write select statements against tables in a dataset?

Thanks,
Rich

Author
15 May 2006 8:00 PM
Charlie Brown
There are several approches you can use so you only have to pull the
data once.  Search google for Master Detail vb.net.  Also look into
using the currency manager or dataview.rowfilters
Author
15 May 2006 8:03 PM
Charlie Brown
Here is a good example from Microsoft to get started with...

http://www.sarcedalloy.com/18 Build a Master-Details Windows Form.zip
Author
15 May 2006 8:20 PM
Rich
Thank you for your replies.  I will search for Master Detail vb.net

http://www.sarcedalloy.com/18

I was not able to open the link above.  But I will keep searching.  Note:  I
am using a currency manager.  The dataview sounds interesing. 

Rich

Show quoteHide quote
"Charlie Brown" wrote:

> Here is a good example from Microsoft to get started with...
>
> http://www.sarcedalloy.com/18 Build a Master-Details Windows Form.zip
>
>
Author
16 May 2006 5:04 AM
Ken Tucker [MVP]
Rich,

          Use the datagrid's setbinding method to bind to a datarelation.

http://www.vb-tips.com/default.aspx?ID=3eafa9ea-a906-45ff-aece-e8335682ad3a

Ken
----------------

Show quoteHide quote
"Rich" wrote:

> Hello,
>
> I have a master and detail table in sql server.  Say the master has 10 rows
> and detail has 45 rows.  I fill 2 tables in my dataset in the client app. 
> When I iterate through the master table in the client app, I display the row
> contents in Textboxes.  I want to display the corresponding detail data for
> each row in a datagrid. 
>
> My question is if I can pull the master and detail data and populate the
> corresponding tables in the dataset in the client app only once and then
> query that data in the client so that when I am at row 1 (ID = 1) in the
> master table  I populate the detail data in the datagrid from the detail
> table in the dataset with detail rows where ID = 1?  Or do I have to pull the
> detai data from the datasource each time for each ID in the master table?
>
> If I can query the detail data at the client app - how is this done?  I am
> using VB2005.  Can we write select statements against tables in a dataset?
>
> Thanks,
> Rich