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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:13:53+00:00 2026-06-13T12:13:53+00:00

I keep getting this error : Cannot insert the value NULL into column ‘Id’,

  • 0

I keep getting this error :

Cannot insert the value NULL into column ‘Id’, table
‘database.dbo.Employees’; column does not allow nulls. INSERT
fails.\r\nThe statement has been terminated.

But the object has this property set with Guid.NewGuid()

I use Entity Framework 4.1 and .net framework 4.0.

The column is primary key and not null. I’m not using Code First approach.

Edit : it seems that the Run Custom tool won’t update the file if I edit manually the file edmx.

  • 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-13T12:13:54+00:00Added an answer on June 13, 2026 at 12:13 pm

    This can happen if you have marked the key property as an autogenerated identity in your model with Fluent API or data annotations…

    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public Guid Id { get; set; }
    

    … (which has the effect that EF won’t send the Id value to the database because it expects that the key is generated there) but in your database table you didn’t specify that the default value for the Id column is newid() so that the database doesn’t generate a new key.

    I you want to send the Guid value manually from the client to the database remove the DatabaseGeneratedOption.Identity specification from your model.

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

Sidebar

Related Questions

On the query below I keep getting this error: Cannot read the next data
Keep getting this error after inserting a subdatasheet into a query and trying to
I keep getting this error saying that it cannot find my javascript function checkpw().
I keep getting this error: cannot call member function 'QString Load::loadRoundsPlayed()'without object Now im
I keep getting this error when I try to load my templates: TypeError: cannot
I keep getting this error: cannot convert parameter 1 from 'char' to 'LPCWSTR' int
i keep getting this error: Exception Details: System.NotSupportedException: Cannot serialize member HannaPrintsDataAccess.Customer.CustomerAddresses of type
I keep getting this error on the second prepopulated... Cannot implicity convert type string
I keep getting this error and have no idea why. I googled and scanned
I keep getting this error on emulator: I copied this from a tutorial and

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.