Saturday, April 11, 2009

Recent Sync Framework articles

Links to a few recent Sync Framework articles:

My First Microsoft Sync Framework Application

A tutorial on getting started with the ADO.NET Sync Services Framework

Manage Your Data Effectively With The Microsoft Sync Framework

MSDN Magazne article, that gives an overview of the Sync Framework, and gives some code samples for ADO.NET Sync Services implementation

Walkthrough: Extending the Local Database Cache to Support Bidirectional Synchronization

Important documentation update, describing the steps required to enable 2-way sync (a common requirement in real life)

Wednesday, April 8, 2009

SqlCeCmd tutorial part one – Managing database files

This tutorial will show various samples of using SqlCeCmd, which is available at – sqlcecmd is the “equivalent” of sqlcmd for the full SQL Server product.

The series will be in three parts, the first one demonstrates how to manage entire database files, the second how to create database objects and insert/update data, the third relating to querying data.

To get information about usage

Simply type “sqlcecmd” at the command prompt:


Notice that the –d parameter is always required. It is a SQL Compact connection string as documented here:

To create a new database file with default settings

sqlcecmd –d “Data Source=C:\test.sdf” –e create

To create a new database file with password and case sensitivity

-d "Data Source=C:\test.sdf;Case Sensitive=True;Password=p"
-e create

To upgrade a version 3.0/3.1 database file to 3.5 format

sqlcecmd -d "Data Source=C:\Northwind.sdf" -e upgrade

To compact a database file

sqlcecmd -d "Data Source=C:\Northwind.sdf" -e compact
Similarly you can shrink or repair a database file, with the shrink, repairdelete and repairrecover options.

To change database options

You can change the following four database options on an  existing database: Change password, Change encryption mode, Change locale id, Change case sensitivity

Possible values for encryption mode are:
engine default or platform default or  ppc2003 compatibility

-d "Data Source=C:\test.sdf;Case Sensitive=True;Password=p"
-z "Data Source=;Encryption Mode=ppc2003 compatibility;Case Sensitive=false"

To drop a database

del c:\test.sdf


Stay tune for the next part, creating and modifying database objects.

Crystal Reports with SQL Compact

I stumbled across this post by Jason Irwin, that describes how to solve the mystery of connecting Crystal Reports to data from a SQL Compact file – by elegantly using a dataset as the “middleman” or common language, if you like.

Monday, April 6, 2009

SQL Compact Schema and Data Export utility updated

Version 1.9 fixes 3 bugs reported by users. Thanks and keep looking!

Fixed date formatting bug in INSERT statements (thanks to user spainb)
Fixed missing update and delete rules on multi field foreign keys (thanks to user samunro)
Fixed too many Primary and Foreign keys returned bug (thanks to user samunro)

The utility has now been downloaded more than 1000 times – thanks for your support, and hope you find it useful.

Thursday, April 2, 2009

New SQL Compact 2005 hotfix

A hotfix for SQL Server 2005 Compact Edition (version 3.0/3.1) for 32 bit desktops, that fixes an issue related to encryption is now available:

FIX: Error message when you try to create an encrypted database of SQL Server 2005 Compact Edition: "The operating system does not support encryption" (968171).