sql-server-ce

Why do I receive file share error if Sql Compact allows multiple connections?

Here, it is said that Sql Server Compact allows up to 256 connections. But when I try to open 2 connections, I receive a file sharing error. How can I solve this? SqlCeConnection c1 = new SqlCeConnection("Data Source=testDB.sdf;Encrypt Database=True;Password=test;File Mode=shared read;Persist Security Info=False;"); SqlCeConnection c2 ...

Determine if table exists in SQL Server CE?

I know this is similar to this question, but I'm using SQL Server CE 3.5 with a WinForms project in C#. How can I determine whether a table exists? I know the IF keyword is not supported, though EXISTS is. Does information_schema exist in CE where I can query against it? Thanks. ...

Sql Compact randomly produces AccessViolationException

I am running Sql Server Compact Edition 3.5.1.0 SP1 in a multi-thread application. The application randomly runs insert queries in transactions. With short transactions, it works fine. But when the transactions get longer and delay between executions get shorter or when I run the application in debug mode, SqlCE begins to throw the follo...

C#: Exception "Input string was not in a correct format." after Row.Delete in DataSet

I am getting a strange exception when trying to update a DataTable after flagging a row for deletion. It looks like it's validating the data in the row I'm trying to delete. I was able to save the same row successfully, why won't it let me delete it? Using C# in VS 2008 and SQL Server CE. The essential bits (I hope) of my code: var li...

How do you work with SQL Server CE and SQL Server 2008 Express?

I have installed: Visual C# 2008 Express Visual Web Developer 2008 Express Visual Studio 2008 SQL Server 2008 Express SQL Server Management Studio In Visual C# 2008 Express, I can "Add Item" and create a "Local Database" (.sdf file) or a "Service Based Database" (.mdf file). Visual Studio 2008 is the same as Visual C# 2008 for appl...

How can I make this query in SQL Server Compact Edition?

Hi, this subquery works in SQL Server: select systemUsers.name, (select count(id) from userIncidences where idUser = systemUsers.id ) from systemUsers How can It be made in SQL Compact? Thanks! ...

Import Access data into SQL Server CE (.mdb to .sdf)

I've found a few articles & discussions on how to import data from Access to SQL Server or SQL Server Express, but not to SQL Server CE. I can access both the the Access data and CE data in the VS database explorer with seperate connections, but don't know how to move the data from one to the other. (I'm using c#.) Any suggestions? T...

Microsoft Sync Services - good solution for me?

We upload sales transactions from our stores to the headoffice server. At the moment, we use DTS (SQL Server Data Transformation Services), but we’re planning on replacing that with Microsoft Sync services for ADO.NET, as this seems to be Microsoft’s preferred solution for this type of setup and we want to follow the standard (that will ...

Installing a SQL Compact-based .NET app

Is there a way to have an application access a SQL Compact database file without having to install the SQL Compact installer as well? I don't want to have a separate installer run when the user installs my program. Can I get by with just some well placed DLL's in my application's folder? ...

Mobile/PDA + SQL Server data synchronization

Hi guys, Need a little advice here. We do some windows mobile development using the .NET Compact framework and SQL CE on the mobile along with a central SQL 2005 database at the customers offices. Currently we synchronize the data using merge replication technology. Lately we've had some annoying problems with synchronization throwin...

SQL Server CE: Insert row to the top of the table

Is this posible? The reason for this is that I'm using a table like a queue, poping the TOP(1) elements sequentially for processing. And I would like to insert some rows to be processed immediately. It's ce 3.5 by the way, thanks. ...

How do you disable all table indexes in sql server compact edition via an SqlCeCommand Object?

I'm trying to do a huge bulk insert into an SqlCe database (version 3.5, oh and using C# 3). I've tried various ways of doing this (table adapter insert, a prepared parameterized query, sqlceresultset insert etc.). The fastest time, as I've read on many sites, was using the SqlCeResultSet object, in table direct mode. I want to speed th...

Why doesn't SQL Server CE support varchar?

I was creating a table in SQL Server CE and realized it doesn't support varchar. Looking this up, I found that "non-Unicode text columns (varchar, char, text) and smallmoney are not supported; although nvarchar, nchar, ntext, and money are supported" as stated at MSDN. Is this true? Why is this, exactly? It would seem that a compact d...

How can I manage SQL CE databases in SQL Server Management Studio?

I created a SDF (SQL CE) database with Visual Studio 2008 (Add / New Item / Local Database). Is it possible to edit this database with SQL Server Management Studio? I tried to attach it but it only offered .mdf and attaching a .sdf file results in "failed to retrieve data for this request". If so, is it possible to create SDF files wit...

Data driven unit tests with MSTest

I'm working on a project that uses MSTest for unit testing and I need to write some unit tests for a model class thats fairly tightly coupled to the data source. We maintain the source code for the database that the model classes are dependent on in a Database Project (.dbproj). What I was thinking of doing was writing a ClassInitialize ...

Convert date in TSQL

I am moving some data and I need to come up with a TSQL statement to convert dates currently in a datetime field to another database field with the varchar MM/yy format. This statement needs to work on both SQL Server 2k5 and also SQL Compact Edition 3.5 - so the answer needs to be "set" based and not include cursors etc that are not s...

Using MS Sync Framework to synchronize two SQL CE Dbs

I'm just working into the Microsoft Sync Framework. It looks quite easy to sync a local SQL CE 3.5 Database with a remote SQL Server 2008 using the SqlSyncAdapterBuilder and SqlServerChangeTracking. Unfortunately, syncing two SQL CE 3.5 Databases doesn't look that easy... The documentation is very sparse, and I don't realy know how to g...

SQLite vs. SQLCE vs. ? in a Mobile Application

When developing a mobile application on Windows Mobile, what are some of the database choices you've made? Why did you make that choice? In particular we've got a mobile app that we're building which will have up to 360,000 records in some of the tables. We were planning to use SQLCE 3.5 but we've got a number of drawbacks when working...

Is this an example of LINQ-to-SQL?

I made a little WPF application with a SQL CE database. I built the following code with LINQ to get data out of the database, which was surprisingly easy. So I thought "this must be LINQ-to-SQL". Then I did "add item" and added a "LINQ-to-SQL classes" .dbml file, dragged my table onto the Object Relational Designer but it said, "The se...

What SYSTEM stored procedures are available in SQL Server Compact Edition?

I'm trying to script the changes to a SQL Server Compact Edition database running on windows mobile 6 and could really use: EXECUTE sp_rename 'MyTable.SomeColumn', 'BrandNewName', 'COLUMN' What other system stored procedures are available? What are the differences to the non compact version? Edit: There ARE system stored procedures...