Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine constraints?
Message
From
16/11/2015 17:38:14
 
 
To
16/11/2015 14:56:06
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 4.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01626946
Message ID:
01627530
Views:
42
>>Hi,
>>
>>I have a XAML/C# .NET application done using VS 2010 and MM.NET.
>>
>>When I run a query to pull out a list of matching AirWay Bills (AWB) I get a notice back: "Failed to enable constraints"
>>
>>This occurs when modifying an existing record and only when a particular AWB is in the resultant list. If I add a nw record, when the same query gets run I do not get this error message.
>>
>>To explain more fully, an Invoice must be assigned to an AWB so I have a combo box on my invoice form and this code:
>>
>>
        protected void autoAWBs_PatternChanged(object sender, Gui.Controls.AutoComplete.AutoCompleteArgs args)
>>        {
>>            //check
>>            if (string.IsNullOrEmpty(args.Pattern))
>>                args.CancelBinding = true;
>>            else
>>            {
>>                args.DataSource = this.AWBLookup.GetAirWayBillsLikeAirWayBillNumber(args.Pattern);
>>            }
>>
>>        }
>>
>>
>>This is the code that runs the Stored Procedure to pull out the matching AWBs:
>>
>>
        public mmBindingList<AirWayBillEntity> GetAirWayBillsLikeAirWayBillNumber(string airWayBillNumber)
>>        {
>>            return this.GetEntityList("AirWayBillsSelectLikeAWBNumber", this.CreateParameter("@awb_number", airWayBillNumber));
>>        }
>>
>>
>>Even if I enter the full AWB # so there is only one possible match I get this error:
>>
>>Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
>>
>>The result set has only one record, with no null values anywhere and no foreign key constraints (as far as I can tell).
>>
>>So I am completely stumped.
>>
>>Anyone have any ideas on how to troubleshoot this?
>
>Hey Frank,
>
>Have you solved this? If so, tell us what you found. If not, then compare the resulting row with the entity properties. My guess is there may be a null value in one of the columns that does not match the property setup to hold it. You can always put a breakpoint on the GetEntityList call and step into the code. Narrowing down exactly where it happens may help. Just for reference, this is a dot net error and not anything by MM, but it would still help to see where. My guess will be right at adapter.Fill() method.

Hi Timothy,

yes I did solve it. I found some code which let me track it down. I thought I had posted the code here, but I guess not. The problem was that the entity was expecting a field that was not part of the query, once I added that field into the query everything worked.
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Previous
Reply
Map
View

Click here to load this message in the networking platform