How to: Manage Passwords for a Database (Devices)

You can set a password when you create a SQL Server Compact 3.5 database, and you can change the password in an existing database.

Security noteSecurity Note:

Including a password in a connection string represents a security risk. For more information, see Securing Databases.

The following sample steps assume that you have a Pocket PC Windows Forms application open.

Note

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 set a password when creating a SQL Server Compact 3.5 database

  1. On the Data menu, click Add New Data Source.

  2. On the Choose a Data Source Type page, click Database, and then click Next.

  3. On the Choose Your Data Connection page, click New Connection to open the Add Connection dialog box.

  4. Click Change, click Microsoft SQL Server Compact 3.5, and then click OK.

  5. In the Add Connection dialog box, click My Computer.

  6. Click Create.

  7. In the Create New SQL Server Compact 3.5 Database dialog box, type a fully-qualified path for the new database (for example, c:\MyDatabase.sdf).

  8. In the New Password and Confirm Password boxes, type a password for the new database, and then click OK.

To change a password in an existing SQL Server Compact 3.5 database

  1. On the View menu, click Server Explorer.

  2. In Server Explorer, right-click the data source for which you want to change the password.

  3. On the shortcut menu, click Database Properties.

  4. In the Database Properties dialog box, click Set password.

  5. Type the old and new passwords as prompted, and then click OK.

See Also

Tasks

How to: Create a Database (Devices)

Concepts

Using SQL Server Compact 3.5 Databases (Devices)

Other Resources

Securing Databases