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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T09:44:04+00:00 2026-05-19T09:44:04+00:00

I am trying to use Entity Framework with SQL Server Compact. I can perform

  • 0

I am trying to use Entity Framework with SQL Server Compact. I can perform reading such as :

var context = new TestEntities();

foreach (var p in context.Personnes)
{
    Console.WriteLine(p.prenom + " " + p.nom);
}

but I can’t perform insert :

var context = new TestEntities();

context.Personnes.AddObject(new Personne() {nom = "Test", prenom = "Test" });

context.SaveChanges();

An UpdateException is raised when I try to do this. The Personne table has just 3 columns: id (int, primary key), nom (varchar) and prenom (varchar).

Here is the display I have when I run the program :

System.Data.EntityCommandCompilationException:
Une erreur s’est produite lors de la
préparation de la définition de la
commande. Pour plus de détails,
consultez l’exception interne. —>
System.NotSupportedException: Les clès
et les valeurs générées par le serveur
ne sont pas prises en charge par SQL
Server Compact.

System.Data.SqlServerCe.SqlGen.DmlSqlGenerator.GenerateInsertSql(DbInsertCommandTree
tree, List1& parameters, Boolean
isLocalProvider)
… System.Data.SqlServerCe.SqlGen.SqlGenerator.GenerateSql(DbCommandTree
tree, List
1& parameters, CommandType&
commandType, Boolean isLocalProvider)
… System.Data.SqlServerCe.SqlCeProviderServices.CreateCommand(DbProviderManifest
providerManifest, DbCommandTree
commandTree)
… System.Data.SqlServerCe.SqlCeProviderServices.CreateDbCommandDefinition(DbProviderManifest
providerManifest, DbCommandTree
commandTree)
… System.Data.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree
commandTree)
… System.Data.Common.DbProviderServices.CreateCommand(DbCommandTree
commandTree)
… System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree
commandTree)
— Fin de la trace de la pile d’exception interne —
… System.Data.Mapping.Update.Internal.UpdateTranslator.CreateCommand(DbModificationCommandTree
commandTree)
… System.Data.Mapping.Update.Internal.DynamicUpdateCommand.CreateCommand(UpdateTranslator
translator, Dictionary2
identifierValues)
… System.Data.Mapping.Update.Internal.DynamicUpdateCommand.Execute(UpdateTranslator
translator, EntityConnection
connection, Dictionary
2
identifierValues, List`1
generatedValues)
… System.Data.Mapping.Update.Internal.UpdateTranslator.Update(IEntityStateManager
stateManager, IEntityAdapter adapter)

Thank you 🙂

  • 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-19T09:44:05+00:00Added an answer on May 19, 2026 at 9:44 am

    SqlServer Compact doesn’t support server-side key generation. You must generate key on application side. So set id explicitly. Here is example.

    context.Personnes.AddObject(new Personne() {id = lastId++, nom = "Test", prenom = "Test" });
    

    You have to maintain lastId. Code that I wrote above will work only in single thread.

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

Sidebar

Related Questions

I'm trying to use the Entity Framework 4.1 RC with a SQL Server 2005
I am trying to use entity framework and get the date from the SQL
I'm trying to expose data from SQL Server database by Entity Framework plus WCF
Entity framework maps DB types to .NET types, for instance SQL Server's BigInt is
I'm trying to do an Entity Framework walkthrough so I: downloaded SQL script here:
I'm trying to use Entity Framework for my model/data access, and running into speed
I am trying to use MVC3 with the Entity framework with Code First, but
While trying to use LINQ to SQL I encountered several problems. I have table
I'm trying to store and retrieve an unsigned int64 using Microsoft SQL Server (and
Trying to use an excpetion class which could provide location reference for XML parsing,

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.