Results 1 to 7 of 7

Thread: Typed Dataset cannot read database...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    Minneapolis, MN
    Posts
    531

    Typed Dataset cannot read database...

    But only one of four tables. The rest work fine.

    Here is the logic, the same logic used on other tables

    Code:
            Dim ta_Completed1 As MaintenanceRequestDataSetTableAdapters.CompletedTableAdapter = New MaintenanceRequestDataSetTableAdapters.CompletedTableAdapter
            ta_Completed1.Fill(DS.Completed)
    This line:
    Code:
    ta_Completed1.Fill(DS.Completed)
    produces the error:
    Failed to enable constraints - One or more rows contain values violating non-null, unique or foreign-key constraints.

    Below is the data, four fields... RequestID, ID, Signoff, Date4 and Notes:

    RequestID ID Signoff Date4 Notes
    98 48 5/27/2020
    100 50 5/28/2020
    105 55 6/8/2020
    106 56 6/8/2020
    110 60 6/9/2020
    111 61 6/9/2020
    113 63 6/10/2020
    114 64 6/10/2020
    115 65 6/11/2020
    117 67 6/11/2020
    119 69 6/11/2020
    120 70 6/12/2020
    121 71 6/12/2020
    122 72 6/12/2020
    123 73 6/15/2020
    124 74 6/16/2020
    125 75 6/16/2020
    126 76 6/17/2020
    127 77 6/18/2020
    128 78 6/18/2020
    129 79 6/19/2020
    130 80 6/19/2020
    134 84 6/22/2020
    135 85 6/23/2020
    136 86 6/24/2020
    137 87 6/24/2020
    138 88 6/24/2020
    139 89 6/25/2020
    140 90 6/26/2020
    141 91 6/30/2020
    142 92 7/1/2020
    143 93 7/6/2020
    144 94 7/6/2020
    145 95 7/7/2020
    146 96 7/8/2020
    147 97 7/13/2020
    148 98 7/13/2020
    149 99 7/13/2020
    150 100 7/14/2020
    151 101 7/14/2020
    152 102 7/14/2020
    153 103 7/15/2020
    155 105 7/16/2020
    157 107 7/16/2020
    158 108 7/17/2020
    159 109 7/20/2020
    160 110 7/21/2020
    161 111 7/21/2020
    162 112 7/21/2020
    163 113 7/23/2020
    164 114 7/24/2020
    165 115 7/24/2020
    166 116 7/27/2020
    167 117 7/28/2020
    168 118 7/28/2020
    169 119 7/29/2020
    170 120 7/29/2020
    171 121 Daryl Radermacher 8/14/2020 darryl will instal when weather is cool enough to alow shutdown
    172 122 7/29/2020
    174 124 8/3/2020
    175 125 8/4/2020
    176 126 8/6/2020
    177 127 8/7/2020
    178 128 8/10/2020
    179 129 8/11/2020
    180 130 8/11/2020
    181 131 8/11/2020
    182 132 8/11/2020
    183 133 8/12/2020
    184 134 8/12/2020
    185 135 8/13/2020
    186 136 8/13/2020
    289 137 12/3/2020


    Pictured below is the Table Design:
    Name:  2021-02-10 16_02_53-sage - Remote Desktop Connection.png
Views: 210
Size:  4.8 KB

    Pictured below is the Relationship in the Dataset:
    Name:  2021-02-10 16_05_13-MaintenanceRequest - Microsoft Visual Studio.jpg
Views: 207
Size:  35.1 KB

    And pictured below is the Query used in the dataset. Query Builder runs fine.
    Name:  2021-02-10 16_07_43-MaintenanceRequest - Microsoft Visual Studio.jpg
Views: 223
Size:  27.1 KB

    I am just beside myself with this error. There is no duplicate data anywhere. Only RequestID and ID cannot be null. ID is auto numbered. This identical logic is also referenced in the code and those tables read and update with no problem. This is the last one, and I am not seeing it.

    Thank you for the help!
    - A 'Hyperactive Member' trying to make a difference in a hyperactive world! And recently, I've been promoted to a 'Finatic Member,' whatever that means!

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Typed Dataset cannot read database...

    My guess is that the ID column has a value that no longer exists in the referenced table. I'm having a bit of trouble following which column Signoff.ID references though.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,532

    Re: Typed Dataset cannot read database...

    Quote Originally Posted by dday9 View Post
    My guess is that the ID column has a value that no longer exists in the referenced table. I'm having a bit of trouble following which column Signoff.ID references though.
    Who says it references anything? It should be the PKey for the table. At least that's what I'd expect it to be given the info.

    -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??? *

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    Minneapolis, MN
    Posts
    531

    Re: Typed Dataset cannot read database...

    There were some RequestID fields missing, but the query to just Fill the data reads...

    Code:
    Select RequestID, ID, Signoff, Date4, Notes FROM dbo.Signoff
    This data cannot be filled...

    I get the missing constraints on the relationship, but I added them in, and still the same error. Perhaps I missed one, unless anyone thinks it may be something else. To me, this is about as simple as it gets.

    RequestID is an integer
    ID is an autonumber integer
    Signoff is a String
    Date4 is a Date
    Notes is a String
    - A 'Hyperactive Member' trying to make a difference in a hyperactive world! And recently, I've been promoted to a 'Finatic Member,' whatever that means!

  5. #5
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,196

    Re: Typed Dataset cannot read database...

    I'm confused.

    The error occurs when you try and fill DS.Completed but you show us information about the table named signoff.

    Also the relation you show is for signoff and request. But that relation has no constraints.

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    Minneapolis, MN
    Posts
    531

    Re: Typed Dataset cannot read database...

    Quote Originally Posted by wes4dbt View Post
    I'm confused.

    The error occurs when you try and fill DS.Completed but you show us information about the table named signoff.

    Also the relation you show is for signoff and request. But that relation has no constraints.
    The correct relation is for Signoff and Request. I pasted the wrong lines. Ironically, the Completed logic is the one that works fine. Data is now consistent between the Request and Signoff table, meaning there is the same RequestID data in both tables.

    Code:
            Dim ta_Signoff1 As MaintenanceRequestDataSetTableAdapters.SignoffTableAdapter = New MaintenanceRequestDataSetTableAdapters.SignoffTableAdapter
            ta_Signoff1.Fill(DS.Signoff)
    This is driving me crazy! Is something corrupt. Should I delete and recreate the table in my dataset?

    Thanks!
    - A 'Hyperactive Member' trying to make a difference in a hyperactive world! And recently, I've been promoted to a 'Finatic Member,' whatever that means!

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2013
    Location
    Minneapolis, MN
    Posts
    531

    Re: Typed Dataset cannot read database...

    The whole issue is fixed now.

    I deleted the Signoff Table Adapter and re-created it.

    I do not understand though, why this happens??
    - A 'Hyperactive Member' trying to make a difference in a hyperactive world! And recently, I've been promoted to a 'Finatic Member,' whatever that means!

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