Questions tagged [sql-server-ce]

3695 questions
12
votes
1 answer

Entity Framework 6 with SQL Server Compact 4.0

I'm (still) trying to follow an online video tutorial on how to use the Entity Framework with the code-first approach. I am as far as my EDM validates fine and it's time to actually build the database. The instructor uses a SQL Server and obviously…
tafkab76
  • 465
  • 1
  • 6
  • 18
12
votes
5 answers

Data paging in SQL Server CE (Compact Edition)

I am writing a wpf destop application, and would like to use SQL Server CE as a backend. I'm trying to come up with a good way to do efficient data paging. In SQL Server Express, I can do something like this: Select ID, FirstName, LastName From…
Neil
  • 737
  • 1
  • 8
  • 23
12
votes
7 answers

Create .mdf/.sdf database dynamically

How can I with "code" create a new .mdf/.sdf database? I've tried this: http://support.microsoft.com/kb/307283 All it does is fail on the ConnectionString. Since I have no connection to a file that exists before I create it, how can I only connect…
Deukalion
  • 2,516
  • 9
  • 32
  • 50
11
votes
2 answers

Create sql server compact file in appdata folder

I am developing a simple piece of software which uses Entity Framework code first and sql server compact 4. At the moment this setup works. Entity framework creates the sql server compact file if it doesn't yet exists. The path to the database is…
Jesse van Assen
  • 2,240
  • 2
  • 16
  • 19
11
votes
3 answers

Does SQL Compact Edition Support Clustered Indexes?

Does SQL CE support clustered indexes?
Brian
  • 5,826
  • 11
  • 60
  • 82
11
votes
2 answers

Unit testing with Effort and SQL CE in parallel fails

I'm evaluating unit tests using EF6 in combination with http://effort.codeplex.com/ and SQL CE Server (Local DB file) http://www.codeproject.com/Articles/460175/Two-strategies-for-testing-Entity-Framework-Effort was a quite good reference but now…
Marcel
  • 1,002
  • 2
  • 16
  • 37
11
votes
2 answers

Combining SQL Rows

I've got SQL Compact Database that contains a table of IP Packet Headers. The Table looks like this: Table: PacketHeaders ID SrcAddress SrcPort DestAddress DestPort Bytes 1 10.0.25.1 255 10.0.25.50 500 64 2 10.0.25.50 …
lumberjack4
  • 2,772
  • 4
  • 30
  • 50
11
votes
2 answers

Delete parent with children in one to many relationship

I have a .NET4.0 application with Entity Framework 5.0 e Sql Server CE 4.0. I have two entities with a one to many (parent/child) relationship. I've configured it to cascade delete on parent removal, but for some reason it doesn't seem to work. Here…
11
votes
4 answers

Methods to migrate SQL Database (mdf) to SQL Compact Edition (sdf)

I have 4 SQL Server 2005 db's that I want to move to SQL CE. I know I cannot keep the SProcs,Views, and Functions(Differences Between SQL Server Compact and SQL Server) but I would like to keep everything else. I have tried this app, SQL Server to…
Refracted Paladin
  • 12,096
  • 33
  • 123
  • 233
11
votes
1 answer

How often should you compact an SQL CE database?

Is there even a need to periodically compact SQL CE databases? Will auto shrink suffice? Our average database size is about 100Mb, with large users hitting 400-500Mb (but those are very rare). If we do have to compact manually, how do we tell when…
Bob King
  • 25,372
  • 6
  • 54
  • 66
10
votes
3 answers

How to change the column order in a SQL Server Compact Edition table schema?

I'm using Visual Studio 2008 to design a SQL Server Compact Edition database (*.sdf). I had to change the schema of one of my tables adding a new column. I want to "move" that new column from the bottom to a different position in the field list.…
splattne
  • 102,760
  • 52
  • 202
  • 249
10
votes
3 answers

Connecting to SQL CE db using SQLConnection

Pretty straightforward question. I'm building an app which reads data from a SQL Server 2005 instance. I wanted to run some tests on my laptop (which does not have SQL 2005) so I was looking at swapping in a local database for the purpose of the…
TygerKrash
  • 1,362
  • 2
  • 20
  • 38
10
votes
5 answers

Connection string for using SQL Server Compact with Entity Framework?

I'm done trying to Google for this. I have installed SQL Server CE 4.0, and have EF 4.1, but I can't get a proper connection string. Nothing on connectionstrings.com applies to me. I just want to create a SqlCeEngine object, but no matter what I…
Tesserex
  • 17,166
  • 5
  • 66
  • 106
10
votes
2 answers

relative path for database file in config file

I've created a WCF REST service that uses nhibernate to connect to sql server compact edition database. Hence I configure the NHibernate datasource like: Data Source=[Path]\MyDb.sdf The…
Manolo
  • 1,597
  • 4
  • 21
  • 35
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