Questions tagged [sql-server-ce-4]

Microsoft SQL Server Compact version 4 is a SQL Server embedded database for building standalone and occasionally connected applications for mobile devices, desktops, and Web clients.

Use this tag if you encounter issues specific for version 4.0 of sql-server-ce. For not version specific issues use the generic tag .

The tag would be primarily used for questions addressing these features:

  • Using CE in combination with Microsoft WebMatrix
  • Designer and debugging capabilities in Visual Studio
  • Medium or partial trust environments in the web servers
  • Sit-by-site deployment
  • The SHA2 encryption algorithms for encrypting the databases
  • T-SQL syntax for OFFSET and FETCH
  • New APIs like SqlCeConnection.GetSchema
  • Server generated keys like identity, rowguid etc.

Taken from the download page

254 questions
37
votes
1 answer

DbSet.Find method ridiculously slow compared to .SingleOrDefault on ID

I have the following code (Database is SQL Server Compact 4.0): Dim competitor=context.Competitors.Find(id) When I profile this the Find method takes 300+ms to retrieve the competitor from a table of just 60 records. When I change the code to: Dim…
Dabblernl
  • 15,831
  • 18
  • 96
  • 148
29
votes
6 answers

Using SQL Server CE 4 on a remote host with MVC 3

I just upgraded my host to MVC 3 but I'm trying to do a "hello world" using SQLCE 4.0 but I just got: Sorry, an error occurred while processing your request. I see my layout and everything but instead of data I see that. On localhost is working as…
Jesus Rodriguez
  • 11,918
  • 9
  • 64
  • 88
28
votes
5 answers

SQL: Return only first occurrence

I seldomly use SQL and I cannot find anything similar in my archive so I'm asking this simple query question: I need a query which one returns personID and only the first seenTime Records: seenID | personID | seenTime 108 3 13:34 …
Nime Cloud
  • 6,162
  • 14
  • 43
  • 75
26
votes
3 answers

Code First Migrations and initialization error

I'm unsure about how to use the code first migration feature. In my understanding it should create my database if it's not existing already, and update it to the latest schema according to migration files. But I'm struggling with it, because I…
22
votes
2 answers

How can I upgrade my Sql Server CE 3.5 sdf database to Sql Server CE 4.0?

I need to update my SqlCE3.5 database to 4.0. I get the following error message when I'm trying to access my 3.5 sdf/database using the new CE4.0 connection provide :- System.Data.EntityException: The underlying provider failed on Open. --->…
Pure.Krome
  • 84,693
  • 113
  • 396
  • 647
14
votes
7 answers

Unable to load the native components of SQL Server Compact

I've installed SQL Server Compact Edition 4.0 on Win7 x64 and it runs both for Asp.Net and Desktop Applications. This PC also have Visual Studio 2010 SP1 installed. But my Server 2008 R2 produces following error for Asp.Net applications, although it…
HasanG
  • 12,734
  • 29
  • 100
  • 154
14
votes
5 answers

How do I open a SQL CE4 .sdf database file?

I installed Microsoft WebMatrix, which, I believe comes with SQL Server CE4. I've tried opening the SDF file in SQL Management Studio (SQL 2008), but I get the following error message: -------- Microsoft SQL Server Management Studio: There is no…
willem
  • 25,977
  • 22
  • 75
  • 115
13
votes
5 answers

Entity Framework 6 Update Graph

What is the correct way to save a graph of objects whose state you don't know? By state I mean whether they are new or existing database entries that are being updated. For instance, if I have: public class Person { public int Id { get; set; } …
Malaise
  • 705
  • 3
  • 8
  • 20
11
votes
5 answers

Why is EF4 trying to re-create my database even though the model hasn't changed?

I have an ASP.NET MVC 3 Beta website using SQL Server CE 4.0. With both ScottGu's NerdDinner example and my own code, I will sometimes get the following exception as soon as I try to access the database: File already exists. Try using a different…
Jedidja
  • 16,610
  • 17
  • 73
  • 112
10
votes
0 answers

A duplicate value cannot be inserted into a unique index

Self answering question for future reference: If you have a table where you deleted and re-added content, you can get this error while inserting new rows with an ID equal to existing IDs: Server Error in '/' Application. A duplicate value cannot be…
Malartre
  • 1,511
  • 18
  • 28
8
votes
2 answers

Very poor performance for batch insert with SQL Server CE 4.0 and Entity Framework 4.2

I'm inserting a lot of data into SQL Server CE 4.0 using Entity Framework 4.2 (code-first), and the performance is abysmal when compared to direct SQL insertion. The model is very simple: public class DocMember { public DocMember() { this.Items…
Thomas Levesque
  • 286,951
  • 70
  • 623
  • 758
8
votes
3 answers

Inserting a row and retrieving identity of new row in SQL Server CE

I'm trying to insert a row and get back the new row's identity with something like this: INSERT INTO blah....; SELECT @@IDENTITY as NewID; I'm trying to execute both statements with a single invocation of a DbCommand object in C#... it doesn't seem…
Brad Robinson
  • 44,114
  • 19
  • 59
  • 88
8
votes
2 answers

ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0' could not be loaded

The Entity Framework provider type 'System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'…
8
votes
1 answer

Does the deprecation of ntext, text, and image affect SQL Server Compact Edition?

According to this MSDN page: ntext, text, and image data types will be removed in a future version of Microsoft SQL Server. Avoid using these data types in new development work, and plan to modify applications that currently use them. Use…
Tom Robinson
  • 8,348
  • 9
  • 58
  • 102
7
votes
1 answer

Why won't my DataContext use SQL Server Compact Edition 4, rather than trying to use 3.5?

I'm playing around with SQL Server Compact Edition 4 CTP1 as I'd like to use it as a datastore for a low-traffic web app. When I try to create a DataContext with a connection string specifying System.Data.SqlServerCe.4.0 (in order to use LINQ To…
Mark Bell
  • 28,985
  • 26
  • 118
  • 145
1
2 3
16 17