Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Create a dataview using criteria from a child table.
 

Create a dataview using criteria from a child table.

I have a Visual Basic .NET 2.0 WinForm application that contains a datagridview and a dataset. The dataset contain two tables with a parent/child relationship like Customer/Orders. The datagridview is bound to the master table. The dataset is created during runtime and the master table populated with a list of files from a user selected directory and is not connected to a physical database. From that point, I’m only creating and updating the child rows in the dataset as the datagridview is mostly used to let the user navigate records.

How do I create various dataviews of the master table based on the contents of the child table? Like “show me all the parent records that have one or more child records�or “show me all the parent records that do not have any child records�

I looked at the filter property of the dataview but that seems to be like the WHERE clause of a select statement.

DeBug

Doug DeBug  Wednesday, May 30, 2007 12:15 AM

I reposted this in the VB forum where it was answered:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1676462&SiteID=1

Thanks!

DeBug

Doug DeBug  Sunday, June 03, 2007 8:26 PM

I would use a datarelation and bindingsourcefor this.

http://www.vb-tips.com/dbpages.aspx?ID=267dc562-3a88-4d84-a700-61f05736a7fa

Ken Tucker  Wednesday, May 30, 2007 10:48 AM

I looked at the link but that example is for two datagridviews using a master/detail example. I'm actually looking for a way to display parent records ona single datagridview based on rows in the child (not displayed) row in a second table.

Perhaps I missed something in the example?

DeBug

Doug DeBug  Wednesday, May 30, 2007 1:06 PM

I reposted this in the VB forum where it was answered:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1676462&SiteID=1

Thanks!

DeBug

Doug DeBug  Sunday, June 03, 2007 8:26 PM

You can use google to search for other answers

Custom Search

More Threads

• bindingsource position after table.AddRow(..)
• Access / ADO.NET/ Concurrent users
• Trouble reading from datatable
• I can't set the column width.....
• DataGridView CurrentRow Not Being Set
• Updating image to datarow
• Not showing the first record
• Treeview
• Custom DatagridTextBoxColumn having Bold font
• Datagird