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 247951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:18:08+00:00 2026-05-11T21:18:08+00:00

I have two tables: CREATE TABLE [dbo].[Context] ( [Identity] int IDENTITY (1, 1) NOT

  • 0

I have two tables:

CREATE TABLE [dbo].[Context] (
  [Identity] int IDENTITY (1, 1) NOT NULL, 
  [Naam] nvarchar (255) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, 
  [Code] nvarchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, 
  [Omschrijving] ntext COLLATE SQL_Latin1_General_CP1_CI_AS NULL) ; 
ALTER TABLE [dbo].[Context] 
  ADD CONSTRAINT [PK_Context] 
      PRIMARY KEY ([Identity]) ; 
ALTER TABLE [dbo].[Context] 
  ADD CONSTRAINT [IX_Context_Naam] 
      UNIQUE ([Naam]) ; 
ALTER TABLE [dbo].[Context] 
  ADD CONSTRAINT [IX_Context_Code] 
      UNIQUE ([Code]) ; 
CREATE TABLE [dbo].[Component] (
  [Identity] int IDENTITY (1, 1) NOT NULL, 
  [ContextLink] int NOT NULL, 
  [Naam] nvarchar (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, 
  [Code] nvarchar (10) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL, 
  [Omschrijving] ntext COLLATE SQL_Latin1_General_CP1_CI_AS NULL) ; 
ALTER TABLE [dbo].[Component] 
  ADD CONSTRAINT [FK_ComponentContext] 
      FOREIGN KEY ([ContextLink]) 
        REFERENCES [dbo].[Context] ([Identity]) ; 

(Above script should create both.)
Basically, I have a Component table that refers to the Context table.

I created a Dynamic Data Site using both tables and .NET will take care of the references for me. It’s a good way to quickly provide some basic website so we can continue to work on the business logic first.

However, when I look at the Component table in the DDS, I notice that the reference shows the code field of the context, not the Name field. So, how do I force the DDS to use the Name field instead when displaying the reference link to the context table?

(Preferably by using something simple, since I’m dealing with over 60 tables that are similar to this one. Most of them simple lookup tables to make filtering easier.)

Since we’re not going to work on the GUI side of this web application for a few months, it’s no option to alter something in the DDS source itself. If it can be fixed in the database or Entity model, then please let me know!


The datamodel I use for this project is simple: every table has a primary key “Identity” which is an autoIncrement field. The Code and Naam (name) fields are to describe specific data and is used in other applications to fill up comboboxes and filters. These applications don’t communicate directly with the database but they use an export XML based on the database. In this export XML, the links to “Identity” get replaced by links to “Code”. This allows the user to change the code to whatever they like without the need to walk through the whole database to adjust the references.
The database has only one purpose: to make it easier for several users to maintain the XML data that another application uses. We have about 5 persons who make modifications to this data about 24/7 and an export XML is generated about once per week, which is then sent to our customers. (Who mostly use this data in an offline application, on laptops with limited internet connectivity.)

  • 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-11T21:18:08+00:00Added an answer on May 11, 2026 at 9:18 pm

    Found it! It’s nasty, though, since it involved editing the entity model itself.
    First, right-click the entity model and select “Open with” to open the file using the XML Editor. Then, go to the tag and look below it to search for an node where the name is that of the child table. (“Component” in my case. It looks like this:

    <EntityType Name="Component">
      <Key>
        <PropertyRef Name="Identity" />
      </Key>
      <Property Name="Identity" Type="Int32" Nullable="false" />
      <Property Name="Code" Type="String" Nullable="false" />
      <Property Name="Naam" Type="String" Nullable="false" />
      <Property Name="Omschrijving" Type="String" Nullable="true" />
      <NavigationProperty Name="Context" Relationship="Content_Model.FK_Component Context" FromRole="Component" ToRole="Context" />
    </EntityType>
    

    As you notice, it puts “Code” before “Name”. Switch those two lines and you’ll get this:

    <EntityType Name="Component">
      <Key>
        <PropertyRef Name="Identity" />
      </Key>
      <Property Name="Identity" Type="Int32" Nullable="false" />
      <Property Name="Naam" Type="String" Nullable="false" />
      <Property Name="Code" Type="String" Nullable="false" />
      <Property Name="Omschrijving" Type="String" Nullable="true" />
      <NavigationProperty Name="Context" Relationship="Content_Model.FK_Component Context" FromRole="Component" ToRole="Context" />
    </EntityType>
    

    Because both “Code” and “Name” have an index, the DDS will just select the first one it discovers in this section. Since I’ve just put “Name” first, it now becomes the text in the reference.

    Basically, a real easy fix, although it took some time to discover…

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

Sidebar

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.