CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2004
    Posts
    35

    Question How to join 2 DataTable in a Dataset?

    helo, anyone have any idea of how to join two data table through a primary key in a dataset. For more specific, I have a "employee" table and a "user" table in a dataset. Not all employee are users, but user must be employee. Thus, i want only the employee that are users are displayed in the datagrid. I am using VB.Net as my programming language. Thanks in advance.

  2. #2
    Join Date
    Jul 2003
    Location
    Singapore
    Posts
    1,822
    just curious, why dont you join the table before putting it in a dataset?
    R. Thomas
    "Be anxious for nothing, but in everything by prayer and supplication, with thanksgiving, let your requests be made know to God; and the peace of God, which surpasses all understanding, will guard your hearts and minds through Christ Jesus."Philippians 4:6-7
    "Rejoice always, pray without ceasing, in everything give thanks; for this is the will of God in Christ Jesus for you."1Thess. 5:16-18

  3. #3
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    DATARELATION is the answer ...

    mythinky, explore DATARELATION class (in the System.Data namespace). It allows you to create join between tables.

    -Cool Bizs

  4. #4
    Join Date
    May 2004
    Posts
    35

    Joining Table in DataSet

    Thanks, i already get an idea, and i join the table first before filling to dataset. Special thanks to all friends that contribute ur time to reply this message

  5. #5
    Join Date
    Sep 2005
    Posts
    6

    Re: How to join 2 DataTable in a Dataset?

    I just finished work on an SQL_Engine that allows you to do exactly what you want.

    Joining ADO.Net DataTables http://home.hot.rr.com/graye/Article...TableJoins.htm
    In-Memory SQL Engine http://home.hot.rr.com/graye/Articles/SQL_Engine.htm

  6. #6
    Join Date
    Feb 2005
    Location
    Israel
    Posts
    1,475

    Re: How to join 2 DataTable in a Dataset?

    Have a look at this thread:
    http://www.codeguru.com/forum/showth...light=joinview

    basically there is a class written by microsoft support which is called JoinView. You can find it here:
    http://support.microsoft.com/kb/325682/EN-US/

  7. #7
    Join Date
    Aug 2006
    Posts
    83

    Thumbs up Re: How to join 2 DataTable in a Dataset?

    Hi all,

    the in-memory SQL engine is doing a great job (once I got it to run...).

    There appears to be an error in PARSE.vb (around line 180):

    After I replaced:
    Code:
    If buf = "+" Or buf = "-" Then ' This is WRONG!!!
    with:
    Code:
    If c = "+" Or c = "-" Then
    it worked.

    I contacted the programmer to verify the solution, but got no response yet. Looks like I didn't produce any new errors, though...

    Enjoy!
    beamer-dreamer

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