.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

how to remove Referential Integrity rules?

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :ASP.Net

I am making a form that reads/writes to a table called Contract.  Contract has a field called BuyerID, which is used to store the PK of a record in the Organization table, OrganizationID.  When I first tried saving my form, I got the following exception:

The record can't be added or changed. Referential integrity rules require a related record in table 'Organization'.
The transaction ended in the trigger. The batch has been aborted.

When I choose a value for the field that gets assigned to BuyerID, I don't get an exception.  I don't want this field to be required, so I need to remove the referential integrity rule.

I thought there must be a foreign key constraint specifying that BuyerID points to Organization.OrganizationID.  However, running

EXEC sp_help 'Contract'

shows that the only constraint for BuyerID is a default value of 0.  Any ideas on how to remove the referential integrity rule?

View Complete Post

More Related Resource Links

About Cascading - Simple Filtering versus "Referential Integrity"

Hola,   It seems that the term "cascading" has not been differently understood by the ASP.Net community.   Most people writing about "cascading" makes you feel like is something that only has to do with "filtering" and nothing else.   I have been trying to understand for almost one year what is all about behind the scenes to make "cascading" work, and it is true that passing values of variables has been a gigantic issue but "not the issue" because when you can do that (passing values) you realize that such things is not simply enough and IT IS NOT THE ASNSWER YOU ARE LOOKING FOR.   I have found many ways of passing these values. I have worked on different approaches and some of them seems to work better than other, more efficient, with less code, with less downgrade in performance, with less calls to the database, etc.   But the "real issue" of cascading is not that, so I'm wondering: How can you make (call it "customize") that the REFERENTIAL INTEGRITY among all different FKs could be maintainded at "DATA LEVEL"?   What I am trying to say is ... ...   Ok! ... Let's suppose you already know how to pass the values of some pre-customized filters to your Insert.aspx page (or any other page) and the dropdowwnlists are shown ok! ... ... ... BUT ... ... ... 

How to check referential integrity


Hi there!

I have a database (MS SQL 2005) in which I have imported a lot of data. During the import I turned off the foreign key constraints. Is there a way to check, which rows in a table or across the whole database are violating the foreign key constraints? Is there any sql statement for this?

Thank you for your help!


Cya, Mike

Remove #Region from whole web site


Hi All,

I need to deliver source code to client and my boss need to remove all the comments and #region sections from the whole web site source code.

So is there any functionality available in visual studio 2010 or may be in an other 3rd party tool available to do so, which can remove all the #region from all over the source code ?

Otherwise my developers has to do donkey work.... :(( and I don't wish it. 

Any help or tips/tricks would be appreciated.


Web deployment project - web.config section replacement does not add remove tag


I have a web application that is actually installed as a component of a third party site.  In some configurations, I need to remove certain connection strings and re-add them.  I'm replacing this web.config section with a xml file that includes the following:

      <remove name="MyOverridenConnection"/>
      <add connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data Source=MyServer" name="MyOverridenConnection"

For some reason the remove tag is left out during the substitution and I end up with the following in the installed config:

      <add connectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MyDb;Data Source=MyServer" name="MyOverridenConnection"

Is there any way to issue removes in replaced sec

Remove characters in a string


i have a string like this   sravani/, asdfff/, lsdsf/
i want to remove last character '/'  in the above string...
which function can i use?

pls help me....

Input Validation: Enforcing Complex Business Data Rules with WPF


Windows Presentation Foundation has a rich data binding system that includes flexible support for business data validation. We take a look at implementing some complex data input validation scenarios that include customized data errors for users.

Brian Noyes

MSDN Magazine June 2010

Secure Habits: 8 Simple Rules For Developing More Secure Code


Never trust data, model threats against your code, and other good advice from a security expert.

Michael Howard

MSDN Magazine November 2006

Draft a Rich UI: Ground Rules for Building Enhanced Windows Forms Support into Your .NET App


In this article, the winning Windows Forms duo of Chris Sells and Michael Weinhardt team up again to explore lots of new features and additions to Windows Forms 2.0 that will let you build more flexible, feature-rich controls, get better resource management, more powerful data-binding abilities, and make your development life a whole lot more fun.

Michael Weinhardt and Chris Sells

MSDN Magazine May 2005

C++ Rules: Power Your App with the Programming Model and Compiler Optimizations of Visual C++


Many programmers think that C++ gets good performance because it generates native code, but even if your code is completely managed you'll still get superior performance. In Visual Studio 2005, the C++ syntax itself has been greatly improved to make it faster to write. In addition, a flexible language framework is provided for interacting with the common language runtime (CLR) to write high-performance programs. Read about it here.

Kang Su Gatlin

MSDN Magazine January 2005

Bugslayer: Three Vital FXCop Rules


In the June 2004 installment of the Bugslayer column, I introduced the amazing FxCop, which analyzes your . NET assemblies for errors and problems based on code that violates the . NET Design Guidelines.

John Robbins

MSDN Magazine September 2004

Web Services: Extend the ASP.NET WebMethod Framework with Business Rules Validation


In an earlier article the authors showed how to build a custom WebMethods extension that provides XML Schema validation, a function that is lacking in ASP.NET. In the process they established a foundation for enforcing business rules during the deserialization of XML data. The technique, which is described in this article, uses declarative XPath assertions to test business rule compliance.In building this business rules validation engine, the authors integrate the validation descriptions into the WSDL file that is automatically generated by the WebMethod infrastructure. Finally, they demonstrate how to extend wsdl.exe, the tool that generates WebMethod proxy/server code from WSDL files, to make use of their extensions.

Aaron Skonnard and Dan Sullivan

MSDN Magazine August 2003

BizTalk: Implement Design Patterns for Business Rules with Orchestration Designer


Because the value of good software planning and design should never be underestimated, it can be beneficial to use one of the many existing design patterns as a foundation for solving some of your toughest architecture problems. This article describes several traditional design patterns including the Observer pattern and the Dispatcher pattern, elaborates on their structures, what they're used for, and how they can help you build a BizTalk-based solution. Following this is a discussion on using the BizTalk Orchestration Designer to build designs and integrate existing business processes.

Christian Thilmany and Todd McKinney

MSDN Magazine October 2001

How To Remove a Query Parameter from a URL


for a string such as this:


how would I remove the parameter id 12?


Remove HTML formatting


Anyone know how to remove html-formatted-string to plain text programatically?

I want to get the same result as if i ctrl+a in a browser's page and then ctrl+v in a notepad.

I was googled how to strip html string, but didn't find the good result.

Removing tag using regex: "<(.|\n)*?>" causes some problems:

* The html-table is not nicely converted to tabbed plain text. It produces *crazy* table in plain text.

* the html-alternate-image lost

* the list ( <ul> & <ol> ) is not conveted well. No numbering or bullets in plain text

SSRS Report viewer + Remove


I am running the report from SSRS report server in the view i am finding that the window title is Report Viewer - Windows Internet Explorer.

How to remove this name and get the name of the report over there.

I am using java at the back end to call the repot through url.

Please help me .

Thanks ,


Items.Remove or RemoveAt Problem


Hi Guys,

I have this issue i have been looking at for a while and cant seem to figure it out. I have two ddl's on my page and a InsertCommand from sqldatasource. My InsertCommand is actually updating the foreign key of the two ddl's in another table. When i click on my button it shows two numbers instead of one.

The challenging thing now is that i have


after the insert so it would not duplicate what i am updating. If i take this statement out of my code. it updates well as in showing the one record that was updated. if i put it back in there it shows two records where updated. I tested my sql statement and its working fine meaning it shows only one record is updating. Could you possibly know whats wrong.

Thanks in Advance

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend