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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:35:52+00:00 2026-05-28T14:35:52+00:00

I am creating two tables in Visual Web Developer 2010 Express using the following

  • 0

I am creating two tables in Visual Web Developer 2010 Express using the following code:

https://i.stack.imgur.com/qd7hu.jpg (sorry, the forum will not let me, due to a new account, post pictures directly)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BarApp.Models
{
    public class Drinks
    {
        public int DrinksId { get; set; }
        public int EstablishmentsID { get; set; }
        public string name { get; set; }
        public decimal price { get; set; }
        public string description { get; set; }
        public string image { get; set; }

        public virtual Establishments establishment { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BarApp.Models
{
    public class Promotions
    {
        public int PromotionsId { get; set; }
        public string name { get; set; }
        public float discount { get; set; }
        public int EstablishmentId { get; set; }
        public int DrinkId { get; set; }
        public string description { get; set; }

        public virtual Establishments establishment { get; set; }
        public virtual Drinks drink { get; set; }
    }
}

But when I look at the created tables, the Promotions table has actual rows for the public virtual code, whereas the Drinks table does not.

I am able to have the Drinks table function the way I want elsewhere in the project, but I cannot get Promotions to behave the same way because it appears that “public virtual” is giving different results in each table.

I do not understand why my Promotions table is actually creating rows for the public virtual variables. Can someone help me understand?

  • 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-28T14:35:54+00:00Added an answer on May 28, 2026 at 2:35 pm

    In this particular situation I was not using the conventional way of referencing the Id field of another table.

    I simply needed to change the following:

    public int EstablishmentId { get; set; }
    public int DrinkId { get; set; }

    to the following:

    public int EstablishmentsId { get; set; }
    public int DrinksId { get; set; }

    My tables were created as expected after I made this change.

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

Sidebar

Related Questions

I need UNION two tables with creating new field, where 1 for first table,
I am creating a new database to manage wish lists. Solution A: Two tables,
What would be the code for creating a table with two foreign keys? I
I am using Entity Framework from .NET 3.5 I have two tables with 0-1
I am creating two tables T1 and T2 in my database. T1 with columns
I'm having trouble in creating a one-to-one relationship between two tables in MS Access
I have two tables, Book and Tag , and books are tagged using the
A colleague was creating a query for two tables he has set up -
I have the following two tables defined... CREATE TABLE [LogLevel] ( [Id] int primary
I'm creating two tables like this: CREATE TABLE abc ( id INTEGER NOT NULL

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.