sql-server-ce

SQL Server Compact Edition 4 - AccessViolationException

僤鯓⒐⒋嵵緔 提交于 2019-12-22 05:52:53
问题 I'm building a .NET 4 WPF application using Entity Framework code first and SQL Server Compact 4.0. I'm trying to call DbContext.SaveChanges() on a background thread to avoid blocking the UI, but I'm occasionally getting the following exception: System.AccessViolationException occurred Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt. Source=System.Data.SqlServerCe StackTrace: at System.Data.SqlServerCe.NativeMethodsHelper.OpenStore

Entity Framewok Code First “ADO.NET provider not found” with local SQL Server CE DLL's

半腔热情 提交于 2019-12-22 04:27:08
问题 I am writing a C# application which uses SQL Server CE 4.0 files, which are accessed through the Entity Framework 6.0 via code-first. (The application needs to be able to use local dll's for the SQL Server CE connection i.e. the application needs to be XCOPY deployable). The application runs fine on my development machine, but on other machines (e.g. VMs with just Win7 and .NET 4.0), I get an ArgumentException : The ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0' is either

What is the difference between Shrink and Compact in SQL Server CE?

烈酒焚心 提交于 2019-12-22 04:10:37
问题 I have a method that is run periodically to optimise my application's SQL Server Compact Edition (3.5) database. The existing code uses the Shrink() method: SqlCeEngine engine = new SqlCeEngine(dbConnectionString); engine.Shrink(); Today I noticed that there's also a Compact() method. Which is preferable for periodic maintenance? 回答1: From the SQL Server Compact Team Blog: The difference between these two is much similar to Internal and External Memory Fragmentation. From SqlCeEngine.Shrink

SQL Server CE database size issue

試著忘記壹切 提交于 2019-12-22 04:06:27
问题 I have an application from a company that went out of business. It appears to use the SQL Server CE database. I have searched the system and can't find any .sdf files. It appears that the database has grown too big. Any idea how I can find the DB and change the maximum size? ERROR message: Unable to log application start. - System.Data.EntityCommandExecutionException: An error occurred while reading from the store provider's data reader. See the inner exception for details. ---> System.Data

Setup EF4 data source for SQL Compact 4

走远了吗. 提交于 2019-12-22 04:03:06
问题 I've installed visual studio 2010 SP1, EF 4.1, SQL Compact 4.0 with vs tools. Everything is appears ok, except I can't use SQL Compact 4 as a data source for Entity framework through the wizard. The only alternative is SQL Compact 3.5. Is there a patch or something I'm missing? Has anyone got EF 4 and SQL Compact 4.0 working together without hacking everything. 回答1: No you're not missing something. In VS2010SP1 SQLCE40 is supported only in web projects. You can get 4.0 EDM support with SQL

How to identify whether the table has identity column

我的梦境 提交于 2019-12-22 01:13:09
问题 I want to find out whether the table has an identity column or not. Table is unknown to me. I have not done the structure of the table. Using Query? I am using Sql Server Compact Edition. 回答1: This is the query which return identity column name; create procedure GetIdentity @tablename varchar(50) begin SELECT OBJECT_NAME(OBJECT_ID) AS TABLENAME, NAME AS COLUMNNAME, SEED_VALUE, INCREMENT_VALUE, LAST_VALUE, IS_NOT_FOR_REPLICATION FROM SYS.IDENTITY_COLUMNS WHERE OBJECT_NAME(OBJECT_ID) =

SQLServerCE DefaultConnectionFactory

杀马特。学长 韩版系。学妹 提交于 2019-12-22 00:44:22
问题 I am using Entity Framework 4.1 and try to connect to a new SQLServerCE 4.0 database inside an MVC Web application. I am using this code Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0", "|DataDirectory|", "test.sdf"); And it raises this exception : Format of the initialization string does not conform to specification starting at index 86. What's wrong with this code? If I use Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System

How to deploy an SQL Compact Edition database file (.sdf) in the AppData folder? Connection string?

…衆ロ難τιáo~ 提交于 2019-12-21 20:26:11
问题 I'm planning to deploy my DB file in the Users\CurrentUserName\AppData folder, because default User Account Control settings restrict write access to the Program Files directory where my program is installed. First question - is this correct? So far, I've created a custom folder, set the DefaultLocation property to [LocalAppDataFolder][ProductName] , and put the .sdf file in that folder. This works in Windows 7, but it doesn't seem to work in Windows XP - I can't find any sign of it being

Migrate from SQLCE 4 to SQL Server 2008

自作多情 提交于 2019-12-21 20:25:33
问题 So, being an early adopter, I have developed an application based on SQLCE4, ASP.Net MVC3 and Entity Framework CTP5 (code first) based on a fit of recklessness induced by reading this announcement. Now the application is moving into production and we need to lose the ce in favour of SQL Server 2008 and later azure. Scott Gu mentioned that tooling would be out soon to support such migrations but I wonder if we're too early to take advantage of an easy route. Anyone done it? Is there a simple

Windows Mobile Synchronization Error

三世轮回 提交于 2019-12-21 16:58:04
问题 I am new to Windows Mobile development and have been investigating methods to synchronize data between PDA's running WM6 and a SQL Server 2005 Database. After some research I decided to go with Windows Synchronization Services. I started by looking at the sample: SyncServicesForDevicesSample I downloaded and installed all the prerequisite software outlined in the readme including: Visual Studio 2008 Professional SP1 SQL Server Compact 3.5 Service Pack 1 (SP1) Synchronization Services for ADO