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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:42:56+00:00 2026-06-14T02:42:56+00:00

I am busy on a school assignment and I have a basic access database

  • 0

I am busy on a school assignment and I have a basic access database that consists of three tables. Book, Reader and BookRated where as BookRated is the intersection table with Primary keys userName from Reader and ISBN from Book make up the composite primary key for BookRated(as foreign keys).

I am trying to insert information into the BookRated table but get the following error

System.Data.OleDb.OleDbException: You cannot add or change a record because a related record is required in table ‘Book’.

bool added;

    int i;
    conn = new OleDbConnection(@"Provider=Microsoft.Jet.OleDb.4.0;
                                Data Source =" + Server.MapPath("App_Data\\BookRateInitial.mdb"));
    conn.Open();

    OleDbCommand cmd2 = conn.CreateCommand();
    cmd2.CommandText = @"INSERT INTO bookRated([frnISBN], [title], [rating], [review], [frnUserName])
                      VALUES(@ISBN, @title, @rating, @review, @userName)";
        //adding my parameters
    cmd2.Parameters.AddRange(new OleDbParameter[]
    {
        new OleDbParameter("@title", bookTitle),
        new OleDbParameter("@rating", rating),
        new OleDbParameter("@review", review), 
        new OleDbParameter("@ISBN", isbn), 
        new OleDbParameter("@userName", userName),
    });
    added = true;
    i = cmd2.ExecuteNonQuery();
    conn.Close();
    return added;

for now all the values are string.

Any advice perhaps as to where this error comes from?

  • 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-14T02:42:57+00:00Added an answer on June 14, 2026 at 2:42 am

    Check relationship of table bookRated. For more info on this error check Microsoft Support Site

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

Sidebar

Related Questions

For school I have to do a assignment, Im busy with it for like
I am busy with a school project where I query a database based on
i'm busy with a school project and I have to build a web app.
I have a busy photo website that is currently making a new page request
Busy learning Ruby... the documentation have an example: hello world.count(lo, o) that return 2
Busy learning MVC 3 and EF ... I have an existing database, I then
I'm busy with creating a website that preferably needs to have a background picture
At school we are busy making a Spotify application. I am currently making an
I am busy creating a less complicated version of NinePatchDrawable that tiles the inner
I'm busy working on a windows phone application that calls a servlet that then

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.