views:

583

answers:

1

How can I create a new SQL Server Compact database file (.sdf) programmatically, without having an existing template file to copy from?

+5  A: 

There is some good info here: Create a SQL Server Compact Edition Database with C#

string connectionString = "DataSource=\"test.sdf\"; Password=\"mypassword\"";
SqlCeEngine en = new SqlCeEngine(connectionString);
en.CreateDatabase();
RedFilter