How to: Create a Database (Devices)
You can create a SQL Server Compact 3.5 database whether you have a project open or not. The database you create can be managed in Visual Studio but is not associated in any way with your device project. To use the database in your device project, you must add the database to your device project as a data source. For more information, see How to: Add a Database to a Device Project.
Two or more processes cannot simultaneously access the same SQL Server Compact 3.5 database over a network share because the second process will cause a file-sharing violation error. However, a process can open multiple connections to the database. For example, the process can run an Insert query on one connection and a Select query on another connection at the same time.
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.
To create the database outside a project
On the View menu, click Server Explorer.
Right-click Data Connections, and then click Add Connection to open the Add Connection dialog box.
In the Data source box, click Microsoft SQL Server Compact 3.5, and then click Continue.
In the Add Connection dialog box, select My Computer.
In the Create New SQL Server Compact Database dialog box, type a fully qualified path for the new database (for example, c:\MyDB).
In the New Password and Confirm Password boxes, type a password (for example, MyPassword) as the password for the new database, and then click OK.
For projects that will be used in real-world applications, select a strong password.
Click OK to return to the Add Connection dialog box.
In the Add Connection dialog box, click Test Connection to ensure that the connection has been made.
The message that appears indicates that the test connection succeeded.
SQL Server Compact 3.5 does not support opening database files on a network share.
Click OK to return to the Add Connection dialog box, and then click OK to close it.
You have created an empty SQL Server Compact 3.5 database that is visible and manageable in Server Explorer. You can use Server Explorer to manage the database and manipulate data. However, at this point, the database is not associated with your device project. To use the database in your device project, see How to: Add a Database to a Device Project.