Link to home
Start Free TrialLog in
Avatar of andrewharris
andrewharris

asked on

Programatically create SQL Server CE 2000 database in C#

Hello,

Can anyone point me to a way to programatically create a SQL Server CE 2000 database (.sdf file) using C#.

Cheers

Andrew
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of andrewharris
andrewharris

ASKER

aneeshattingal my friend... you are a star! That worked a treat, just had to change C:\ to a valid Pocket PC path, ie \\Program Files\\TestApp\\, etc

And just to add for anyone else who looks for this, to password protect the database:

SqlCeEngine engine = new SqlCeEngine("Data Source='\\Program Files\\TestApp\\test.sdf'; Password='password'");
engine.CreateDatabase();

Cheers

Andrew
Ok.. Now you can close the Question ...