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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:43:06+00:00 2026-05-24T10:43:06+00:00

I have two tables, RESTAURANT and HOURS with REST_ID as the key between the

  • 0

I have two tables, RESTAURANT and HOURS with REST_ID as the key between the two tables. i receive an error when I get to the first line of code to add HOURs. The error asks to create an instance of the object but Intellisence allows me to call that table reference. Here is a snipped of the code:

RESTAURANT addRest = new RESTAURANT();
    addRest.REST_NAME = r_name;
    addRest.REST_STREET1 = r_street;
    addRest.REST_PHONE = r_phone;
    addRest.REST_WEBSITE = r_web;
    addRest.REST_DESC = r_desc;
    addRest.HOUR.HOURS_SUN = h_su;
    addRest.HOUR.HOURS_MON = h_mo;
    addRest.HOUR.HOURS_TUE = h_tu;
    addRest.HOUR.HOURS_WED = h_we;
    addRest.HOUR.HOURS_THU = h_th;
    addRest.HOUR.HOURS_FRI = h_fr;
    addRest.HOUR.HOURS_SAT = h_sa;
    addRest.HOURReference.EntityKey = new EntityKey("FVTCEntities.HOURS", "HOURS", 1);
    db.AddToRESTAURANTs(addRest);
    db.SaveChanges();
  • 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-24T10:43:07+00:00Added an answer on May 24, 2026 at 10:43 am

    HOUR is a contained object inside of RESTAURANT. You need to instantiate it before setting properties on it (like a typical C# object):

    addRest.HOUR = new HOUR();
    addRest.HOUR.HOURS_SUN = h_su;
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two tables CREATE TABLE table1 (id int primary key auto_increment,....); CREATE TABLE
I have two tables users and work_orders. Now I need to get work_orders results
I have two tables, when I check a item in first table it adds
Have two tables named Employee and Order. The relations between the tables Employee (1)
I have two tables with a foreign key constraint how can I delete rows
I have two tables in a MySQL database. In the first column of data
Have two tables with a linking table between them. USERS +-------+---------+ | userID| Username|
I have two tables. First table looks like this: Table: Records rid | user
I have two tables related by a composite primary key and one of the
I have two tables images2 and image_data So the goal is to have 1

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.