SQL CE is a free, embedded, lightweight database engine that enables easy database storage. This does not required any installation and runs in memory. Visual Studio 2010 SP1 Came up with nice tooling support for SQL Server CE. We can add a SQL CE Data base using Add New Item option from Solution Explorer Context Menu. But In this tip I am going to talk about how you can add a New SQL CE Database or Add a Existing one from Server Explorer.
This will also help you to connect with some existing created SQL CE Databases as well. Below are the steps which you needs to follow.
First open the Server Explorer from View > Server Explorer ( Ctrl + W , L )
Then Click on “Connect To Data Base Icon”
This will brings up the “Add Connection Dialog” but default Data Source is set to “Microsoft SQL Server ( SqlClient) . Click on “Change..”
In “Change Data Source” dialog, select “Microsoft SQL Server Compact 4.0” as Data Source and by it will have only single Data Provider “.NET Framework Data Provider for Microsoft SQL Server Compact 4.0”
on click of “Ok” it will navigate back to “Add Connection Window”.
There you can “Create a New SQL CE DB” or can browse existing “SQL CE DB”
Click on “Browse” will launch the Open File dialog box from where you have to specify the existing file names . If you want to create a new open click on “Create” button, it will launch Create New SQL CE Compact Data Base Window.
Provide file name and required information and click on OK, you will find the SQL CE Database on the Server Explorer.