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

  • Home
  • SEARCH
  • 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 8796005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:31:15+00:00 2026-06-13T23:31:15+00:00

there are 3 database tables (movies, reviews, users) the reviews table include ( MemeberID,

  • 0

there are 3 database tables (movies, reviews, users)

the reviews table include ( MemeberID, MovieID, Review Text, Rate, ReviewDate)
(the MemeberID, and MovieID in the Review are the FK of the members table and the movies table)
The Movie can have many reviews, and i’m trying to add review to a movie

even I have movie class and the member class, I have a problem, in order to insert review, i need to reference it to movie and users , link them, and i don’t know how to do it

this code make a error:

" The relationship between the two objects cannot be defined because they are attached to different ObjectContext objects. "

This is my code…

public bool InsertNewReview(Movie _TheMovie, Member _TheMember, string _Text, byte _Rate, DateTime _ReviewDate)
    {

       Review ReviewToInsert = new Review()
            {
                MovieID = _TheMovie.MovieID,
                MemberID = _TheMember.MemberID,
                Movie = _TheMovie,
                Member =  _TheMember,
                Rate = _Rate,
                ReviewDate = _ReviewDate,
                ReviewText = _Text
            };

        videoLib.Reviews.AddObject(ReviewToInsert);
        videoLib.SaveChanges();

            return true;

    }

..

there are more data to insert to the Review class

Images: here

..

and the tables: (the “all columns” isn’t a field in database tables)

Images: here

  • 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-06-13T23:31:17+00:00Added an answer on June 13, 2026 at 11:31 pm

    I got a solution, I need to define only the MovieID, MemberID, and not using their object

    and use try & catch, to detect if thier the same MovieID (fk) and MemberID (fk) in the same row (because the review don’t have is own id in the database)

       public bool InsertNewReview(string _MovieID, int _MemberID, string _Text, byte _Rate, DateTime _ReviewDate)
        {
            try
            {
                Review ReviewToInsert = new Review()
                {
                    Rate = _Rate,
                    ReviewDate = _ReviewDate,
                    ReviewText = _Text,
                    MovieID = _MovieID,
                    MemberID = _MemberID
                };
    
                videoLib.Reviews.AddObject(ReviewToInsert);
                videoLib.SaveChanges();
                return true;
            }
    
            catch
            {
                return false;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL database with two tables (simplified for this question): movies table
Is there a free utility that will fill up your database tables with test
in my database there are 3 tables CustomerType CusID EventType EventTypeID CustomerEventType CusID EventTypeID
I have an existing database with tables which each have 4 partitions (there are
I've got collection of geo objects in database: There are four Tables: Countries Regions
There are three tables in my database: apples, refrigerators, and houses. Each apple belongs
Is there a way to alter/create tables in built in air database, other then
Is there a SQL command that will list all the tables in a database
Is there an easy way to reset a django database (i.e. drop all data/tables,
We have two tables in a SQL Server 2005 database, A and B.There is

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.