Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Reply
Thread Tools

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

 
 
Bobby Edward
Guest
Posts: n/a
 
      10-31-2008
I have an xsd dataset. I created a simple query called GetDataByUserId. I
can preview the data fine!

I created a very simple BLL function that calls it and returns a datatable.

When I run the code I get....

=======================

Server Error in '/MyCompanyMyProject' Application.
Failed to enable constraints. One or more rows contain values violating
non-null, unique, or foreign-key constraints.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.ConstraintException: Failed to enable
constraints. One or more rows contain values violating non-null, unique, or
foreign-key constraints.

Source Error:

Line 2366: End If
Line 2367: Dim dataTable As dsUsers.myoptionsDataTable = New
dsUsers.myoptionsDataTable
Line 2368: Me.Adapter.Fill(dataTable) <==== LINE IS IN RED!
Line 2369: Return dataTable
Line 2370: End Function

Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET
Files\MyCompanyMyProject\7eeeedcd\743a3129\App_Cod e.zobkgcsa.15.vb Line:
2368

=======================

Any idea why?

I verified all the data, that no pk/fk are violated, etc... Even when I
turn 'enforce constraints' off in the xsd dataset properties it still fails.


 
Reply With Quote
 
 
 
 
sloan
Guest
Posts: n/a
 
      10-31-2008

You have to ~~anally~~ go over the column names...of your ResultSet.
And compare to the strong dataset.

~anally~

Every columnName....

My guess is that you're either not returning a certain column or ... you
have a mismatched name.

Select LastName from dbo.Emp

and you ds has "LName" in the column name or something like that.

Check datatypes as well!



"Bobby Edward" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have an xsd dataset. I created a simple query called GetDataByUserId. I
>can preview the data fine!
>
> I created a very simple BLL function that calls it and returns a
> datatable.
>
> When I run the code I get....
>
> =======================
>
> Server Error in '/MyCompanyMyProject' Application.
> Failed to enable constraints. One or more rows contain values violating
> non-null, unique, or foreign-key constraints.
> Description: An unhandled exception occurred during the execution of the
> current web request. Please review the stack trace for more information
> about the error and where it originated in the code.
>
> Exception Details: System.Data.ConstraintException: Failed to enable
> constraints. One or more rows contain values violating non-null, unique,
> or foreign-key constraints.
>
> Source Error:
>
> Line 2366: End If
> Line 2367: Dim dataTable As dsUsers.myoptionsDataTable = New
> dsUsers.myoptionsDataTable
> Line 2368: Me.Adapter.Fill(dataTable) <==== LINE IS IN RED!
> Line 2369: Return dataTable
> Line 2370: End Function
>
> Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
> ASP.NET Files\MyCompanyMyProject\7eeeedcd\743a3129\App_Cod e.zobkgcsa.15.vb
> Line: 2368
>
> =======================
>
> Any idea why?
>
> I verified all the data, that no pk/fk are violated, etc... Even when I
> turn 'enforce constraints' off in the xsd dataset properties it still
> fails.
>
>



 
Reply With Quote
 
 
 
 
Bobby Edward
Guest
Posts: n/a
 
      11-01-2008
Thanks.

It's a simple SELECT of all the fields in the table WHERE xxxx = input
param. When I preview it (in dataset designer) it's fine, even passing it
the same variable.

When I run it thru code it fails.

Any ideas?

"sloan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> You have to ~~anally~~ go over the column names...of your ResultSet.
> And compare to the strong dataset.
>
> ~anally~
>
> Every columnName....
>
> My guess is that you're either not returning a certain column or ... you
> have a mismatched name.
>
> Select LastName from dbo.Emp
>
> and you ds has "LName" in the column name or something like that.
>
> Check datatypes as well!
>
>
>
> "Bobby Edward" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I have an xsd dataset. I created a simple query called GetDataByUserId.
>>I can preview the data fine!
>>
>> I created a very simple BLL function that calls it and returns a
>> datatable.
>>
>> When I run the code I get....
>>
>> =======================
>>
>> Server Error in '/MyCompanyMyProject' Application.
>> Failed to enable constraints. One or more rows contain values violating
>> non-null, unique, or foreign-key constraints.
>> Description: An unhandled exception occurred during the execution of the
>> current web request. Please review the stack trace for more information
>> about the error and where it originated in the code.
>>
>> Exception Details: System.Data.ConstraintException: Failed to enable
>> constraints. One or more rows contain values violating non-null, unique,
>> or foreign-key constraints.
>>
>> Source Error:
>>
>> Line 2366: End If
>> Line 2367: Dim dataTable As dsUsers.myoptionsDataTable = New
>> dsUsers.myoptionsDataTable
>> Line 2368: Me.Adapter.Fill(dataTable) <==== LINE IS IN RED!
>> Line 2369: Return dataTable
>> Line 2370: End Function
>>
>> Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary
>> ASP.NET
>> Files\MyCompanyMyProject\7eeeedcd\743a3129\App_Cod e.zobkgcsa.15.vb Line:
>> 2368
>>
>> =======================
>>
>> Any idea why?
>>
>> I verified all the data, that no pk/fk are violated, etc... Even when I
>> turn 'enforce constraints' off in the xsd dataset properties it still
>> fails.
>>
>>

>
>



 
Reply With Quote
 
Bobby Edward
Guest
Posts: n/a
 
      11-01-2008
Thanks I got it. Per your suggestion I went over it again. For some reason
a field was marked as a PK where it shouldn't be. Wierd.

THANKS SLOAN!!!


 
Reply With Quote
 
sloan
Guest
Posts: n/a
 
      11-03-2008
Key word : Anally.

Its always something super small.



"Bobby Edward" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks I got it. Per your suggestion I went over it again. For some
> reason a field was marked as a PK where it shouldn't be. Wierd.
>
> THANKS SLOAN!!!
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RCR: String#contain? and Array#contain? Roger Pack Ruby 3 09-28-2010 04:13 PM
Does string contain A, and if so, does a section of string contain B Jason Carlton Javascript 11 12-08-2009 06:07 PM
Gridview error: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Bobby Edward ASP .Net 1 10-14-2008 04:09 AM
Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. bazzer ASP .Net 1 04-06-2006 01:31 PM
SMC violating Microsoft Licences agreements? ilovemyview@yahoo.com ASP .Net 4 09-06-2005 10:27 AM



Advertisments