Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3626794
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:48:26+00:00 2026-05-18T23:48:26+00:00

i have a generic problem all over my application and want to see if

  • 0

i have a generic problem all over my application and want to see if there is a common generic way of solving it.

The main issue is how to let users know which records are linked when you try to delete a record from a joined table.

for example, let’s say i have two database tables.

  1. Customer
  2. Branch

where Customer has a branchId field.

if i go delete a record from the branch table, it will fail if there are customers that have that branchId in its foreign key.

if i try to delete this through code, i get an error saying that it can’t delete because of a referencial integrity constraint but it doesn’t let me know what the actual linked tables is or which particular records are causing the link.

Is there any generic C# code that handles this situation that would either:

  1. Give a better error message back and show you the records that are links
  2. Even better, lets you change the linked records at that time to a default reference or a null reference (in cases where the foreign key is nullable)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:48:26+00:00Added an answer on May 18, 2026 at 11:48 pm

    You might consider creating a trigger on the Branch table that sets any Customer records referencing the Branch record that is going to be deleted to BranchId = null.

    This should allow you to delete Branches and remove any associations from existing customers.

    Here is an article that goes over something similar.

    Be warned that you will probably have some confused customers if you start changing their data without them knowing it…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem trying to design some generic storage.. Basically I have the
I have a problem with slashes! I have some jQuery for handling generic dialogs
I want to write in Delphi (2009 - so I have generic dictionary class)
Is there any name for the following DB table design: Basically we have generic
I have a generic Print method that iterates over a list and simply prints
I have an application with a heirarchy of packages. There are a fair number
I have over 30 aspx pages, i have discovered a problem recently that if
Background I have an application written in native C++ over the course of several
I want to display the same options menu on all of my application's activities.
I have been having this problem and been pulling my hair out over it.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.