0

I am using the VS2010 + SQL Server CE 3.5 + EF + Framework 4.

I have no problem in reading data from SQL Server CE.

But on inserting data with this code:

EFConn.SaveChanges();

I get an error:

Error: An error occurred while updating the entries. See the inner exception for details.

please help me...

Error detail :

System.Data.UpdateException was unhandled

Message=An error occurred while updating the entries. See the inner exception for details.

Source=System.Data.Entity

InnerException: System.Data.EntityCommandCompilationException

Message=An error occurred while preparing the command definition. See the inner exception for details.

Source=System.Data.Entity

InnerException: System.NotSupportedException

Message=Server-generated keys and server-generated values are not supported by SQL Server Compact.

Source=System.Data.SqlServerCe.Entity

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
maktab
  • 77
  • 2
  • 2
  • 9

1 Answers1

0
  1. SQL CE version 4.0 fixed this problem with its Entity Framework provider. You can download it from http://www.microsoft.com/en-us/download/details.aspx?id=17876

  2. If you don't want to change SQL CE, you can try to change the field type to uniqueidentifier. You can do this Server-generated keys and server-generated values are not supported by SQL Server Compact

Hope this helps

Community
  • 1
  • 1
Pablo Claus
  • 5,886
  • 3
  • 29
  • 38