dataset merging

Discussion in 'ASP .Net' started by Neil Chambers, May 29, 2008.

  1. I am trying to get my head around dataset merging but despite a little
    research I could still use a pointer (or ten). Basically I want to perform
    an outer join operation on a dataset (created from a file operation) and the
    resulting sql query based on the contents of said dataset. Effectively I
    would end up with two dataset tables in my application. If I were writing
    this to action from two tables it would be thus:



    SELECT ds.id, db.*
    from
    dataset ds LEFT OUTER JOIN
    database db on db.field1 = ds.id

    such that I retain the original dataset items. I have read something about a
    dataset relationship but I do not see how this achieves the all-inclusive
    results I am after.

    any insight much appreciated :)

    n
    Neil Chambers, May 29, 2008
    #1
    1. Advertising

  2. Neil Chambers

    sloan Guest

    The dataset "merge" method can do about 2 things from my experience.

    1. If you have N number of different datatables, it can merge the N number
    of tables into 1 (common) dataset.

    2. If you have different ROWS, but the same table, you can merge the rows
    together. Most times, the rows will be different.

    3. A combo of 1 and 2.

    If you try to merge rows and the rows have the same primary key, but you're
    trying to merge columns of the same row, you'll have trouble.

    Back to your question. You can't do what you're trying with a dataset. the
    ..select and .merge methods are very very basic.

    You need to look at LINQ. Or you'll have to loop and do your logic if
    you're in a pre 3.5 framework.

    ...



    "Neil Chambers" <> wrote in message
    news:%...
    >I am trying to get my head around dataset merging but despite a little
    >research I could still use a pointer (or ten). Basically I want to perform
    >an outer join operation on a dataset (created from a file operation) and
    >the resulting sql query based on the contents of said dataset. Effectively
    >I would end up with two dataset tables in my application. If I were writing
    >this to action from two tables it would be thus:
    >
    >
    >
    > SELECT ds.id, db.*
    > from
    > dataset ds LEFT OUTER JOIN
    > database db on db.field1 = ds.id
    >
    > such that I retain the original dataset items. I have read something about
    > a dataset relationship but I do not see how this achieves the
    > all-inclusive results I am after.
    >
    > any insight much appreciated :)
    >
    > n
    sloan, May 29, 2008
    #2
    1. Advertising

  3. Aha!

    the primary key property does the trick. When I merge now it does so based
    on the PK and I get the exact inclusive results I am after!

    Many, many thanks!

    : n)

    "sloan" <> wrote in message
    news:O6c3%...
    >
    > The dataset "merge" method can do about 2 things from my experience.
    >
    > 1. If you have N number of different datatables, it can merge the N
    > number of tables into 1 (common) dataset.
    >
    > 2. If you have different ROWS, but the same table, you can merge the rows
    > together. Most times, the rows will be different.
    >
    > 3. A combo of 1 and 2.
    >
    > If you try to merge rows and the rows have the same primary key, but
    > you're trying to merge columns of the same row, you'll have trouble.
    >
    > Back to your question. You can't do what you're trying with a dataset.
    > the .select and .merge methods are very very basic.
    >
    > You need to look at LINQ. Or you'll have to loop and do your logic if
    > you're in a pre 3.5 framework.
    >
    > ..
    >
    >
    >
    > "Neil Chambers" <> wrote in message
    > news:%...
    >>I am trying to get my head around dataset merging but despite a little
    >>research I could still use a pointer (or ten). Basically I want to perform
    >>an outer join operation on a dataset (created from a file operation) and
    >>the resulting sql query based on the contents of said dataset. Effectively
    >>I would end up with two dataset tables in my application. If I were
    >>writing this to action from two tables it would be thus:
    >>
    >>
    >>
    >> SELECT ds.id, db.*
    >> from
    >> dataset ds LEFT OUTER JOIN
    >> database db on db.field1 = ds.id
    >>
    >> such that I retain the original dataset items. I have read something
    >> about a dataset relationship but I do not see how this achieves the
    >> all-inclusive results I am after.
    >>
    >> any insight much appreciated :)
    >>
    >> n

    >
    >
    Neil Chambers, May 29, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nedu N
    Replies:
    1
    Views:
    1,791
    Chris Taylor
    Oct 31, 2003
  2. JimO

    DataSet and dataSet

    JimO, Mar 1, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    517
    Mary Chipman [MSFT]
    Mar 8, 2006
  3. Joseph D. DeJohn

    DataSet to DataSet

    Joseph D. DeJohn, Aug 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    394
  4. Nedu N
    Replies:
    2
    Views:
    2,150
  5. William Gower
    Replies:
    2
    Views:
    4,130
    Brian Baker [MVP]
    Jul 26, 2004
Loading...

Share This Page