CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2002
    Location
    St.Louis MO, USA
    Posts
    672

    How can I retrieve Current Relational Data from DataSet

    I have two tables
    tblEntity [ Entity ID , Entity Name ,........]
    tblUser [ UserID , Entity ID , UserName , ............]

    I have created DataRelation "entityVuser" in between these two tables and successfully added in DataSet. I have two comboboxes one is showing Entity Names and when i select an entity the second combobox shows its related Users through “entityVuser" relation.

    Can I retrieve such users from dataSet directly? Let’s suppose I have a function
    comboBox_EntityNames_SelectionChangeCommitted( ....... )
    Q1.when i select an entity from EntityNames combobox this function will be fired and i want to get list of all users related to selected entity.
    Is it possible?
    I m curious about the architecture of ComboBox ( DisplayMember and ValueMember)
    for example
    Code:
    comboBox_UserLastName.DataSource	= m_ds;
    				comboBox_UserLastName.DisplayMember	= "Entity.entityVuser.UserLastName";
    				comboBox_UserLastName.ValueMember	= "Entity.entityVuser.UserId";
    How Combobox retrieve such relational values from data set.

    Is there any way like, I get child table data directly from dataset?
    m_ds.Tables["Entity.entityVuser"].Columns["UserLastName"]
    Last edited by Naumaan; February 8th, 2007 at 01:51 PM.
    A Person who is polite is given goodness and a person who is away from Politeness is away from Goodness.

    NAUMAAN

  2. #2
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    1,080

    Re: How can I retrieve Current Relational Data from DataSet

    You would use the GetChildRows method of the selected parent DataRow.
    Tutorials: Home & Learn | Start VB.NET | Learn VB.NET | C# Station | GotDotNet | Games in VB.NET 101 Samples: 2002 | 2003 | 2005 | More .NET 2.0 (VB.NET, C#) Articles: VB.NET | C# | ASP.NET | MoreFree Components: WFC | XPCC | ElementsEx | VBPP | Mentalis | ADO.NET/MySQL | VisualStyles | Charting (NPlot, ZedGraph) | iTextSharp (PDF) | SDF (CF) ● Free Literature: VB 2005 (eBook) | VB6 to VB.NET (eBook) | MSDN Magazine (CHM format) ● Bookmarks: MSDN | WinForms .NET | ASP.NET | WinForms FAQ | WebForms FAQ | GotDotNet | Code Project | DevBuzz (CF) ● Code Converter: C#/VB.NET | VB.NET/C# | VS 2005 add-in

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured