Results 1 to 6 of 6

Thread: [RESOLVED] parent/child datagridview

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    Resolved [RESOLVED] parent/child datagridview

    Help..

    I have two sql tables.

    SELECT [CarNumber]
    ,[DD_Key]
    ,[dateService]
    ,[mileage]
    ,[Description]
    ,[Cost]
    ,[LaborCost]
    ,[ServiceType]
    ,[ServicePreformed]
    ,[ServiceLineNote]
    FROM [dbo].[CarDescriptions]

    and

    SELECT [CICARNUMBER]
    ,[CIPSEQ]
    ,[CI_Key]
    ,[CISDC]
    ,[CINOTE]
    ,[CIPATH]
    ,[CITYPE]
    ,[CISDAT]
    ,[CISDTS]
    ,[CISUSET]
    ,[CISWSTN]
    FROM [dbo].[PINDEXSCAN]

    CarDescription is the parent in this case. I want to load two datasets with CarNumber as primary key for CarDescription and then merge PINDEXSCAN to the parent by matching DD_KEY = CI_KEY...

    I am building two seperate dataset but am having the issue in merging the two resulting tables

    table1Column = result_DD.Tables("Table1").Columns(1)
    table2Column = result_DD.Tables("table2").Columns(2)
    //
    //relating tables
    relation = *New DataRelation("relation", table1Column, table2Column)

    result_DD.Relations.Add(relation)

    Compile errors...
    What am I doing wrong??

    thanks

    gollnick
    William E Gollnick

  2. #2
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: parent/child datagridview

    Why dont you just add the third dataset with the relation defined in the SQL Query?

    Code:
    SELECT [CarNumber],[DD_Key],[dateService],[mileage],[Description],[Cost],[LaborCost],[ServiceType],[ServicePreformed],[ServiceLineNote]
    FROM [dbo].[CarDescriptions] A
    LEFT JOIN
         SELECT [CICARNUMBER],[CIPSEQ],[CI_Key],[CISDC],[CINOTE],[CIPATH],[CITYPE],[CISDAT],[CISDTS],[CISUSET],[CISWSTN]
         FROM [dbo].[PINDEXSCAN] B
    ON A.DD_Key = B.CI_Key
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    Re: parent/child datagridview

    Thanks.. But will this allow me to have a tree like presentation on my datagrid as the result) You know.. Parent line with a + if there are children under it??

    thanks

    gollnick
    William E Gollnick

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: parent/child datagridview

    likely not.


    But... your DD_KEy is not columns(1) ... it's Columns(0) ... CI_Key is also off by one as well... remember arrays in .NET are 0-based... not 1-based. Better still, use the column names.

    Secondly, I doubt you got a generic "compile error" ... usually there's more to it than that... and it's often syntax related - otherwise it would compile.
    What are table1Column & table2Column defined as?

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5
    PowerPoster kaliman79912's Avatar
    Join Date
    Jan 2009
    Location
    Ciudad Juarez, Chihuahua. Mexico
    Posts
    2,593

    Re: parent/child datagridview

    Why dont you do it in the dataSet designer in the GUI?
    More important than the will to succeed, is the will to prepare for success.

    Please rate the posts, your comments are the fuel to keep helping people

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Location
    Hendersonville , NC
    Posts
    260

    Re: parent/child datagridview

    Actually the keyfields are correct -- [CarNumber] , ,[DD_Key] and SELECT [CICARNUMBER],[CIPSEQ],[CI_Key] ..

    I'm just confused how how to do this in order to make it present correctly (as a Tree + datagrid )
    William E Gollnick

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