Results 1 to 4 of 4

Thread: [RESOLVED] [1.0/1.1]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182

    Resolved [RESOLVED] [1.0/1.1]

    Having problem with DataSet populated from MS Access db. It is generated from Union query and can contain not unique records, e.g. query result:

    ID Amount
    10 25
    11 30
    10 25
    15 40


    Dataset simply deletes repeated record, so in the dataset records presented as:
    ID Amount
    10 25
    11 30
    15 40


    Because dataset populated from two quite similar tables, the uniqueness of records cannot be guaranteed (including more fields in the result query cannot it provide as well).

    One solution can be: get two datasets from the both tables and add records from the second dataset to the first one, setting datarow ‘ID’ to some unique number. But I am wondering, is there any properties in a dataset object which will allow to keep all records, or may be there is some other simple way to solve this problem?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [1.0/1.1]

    DataSets don't simply delete records. The DataSet will contain whatever records your query returns. If you aren't getting the result you want then you're query is flawed.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182

    Re: [1.0/1.1]

    Thanks for your suggestion. The problem was in union query, I missed keyword ALL which should be put after UNION, so the query did not return all rows. After using UNION ALL everything fixed.

  4. #4
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: [1.0/1.1]

    Please mark this thread resolved from the Thread Tools menu above the first post.

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