Searching...
Friday, 19 July 2013

SQL Server Database Instance Not Found Error Solution

To create a new SQL Server Compact database

  1. To open Server Explorer/Database Explorer, on the View menu, click Server Explorer/Database Explorer.
  2. Right-click the Data Connections node and click Add Connection.
  3. If the Add Connection dialog box opens, verify that the Data Source is Microsoft SQL Server Compact (.NET Framework Data Provider for SQL Server Compact). If it is not, click the Change button, click theMicrosoft SQL Server Compact data source, and click OK.
  4. Leave the default selection of My Computer in the Data Source area.
  5. Click the Create button in the Connection Properties area.
  6. In the Create New SQL Server Compact Database dialog box, provide the file path, database file name, and password of the new database. You can also choose to encrypt the data.
  7. Click OK to return to the Add Connection dialog box. Note that the Database box now contains the path to the new database.
    1. Note
      At this point the database has been created. Clicking Cancel in the dialog box will not delete the newly created file.
    2. Click Test Connection to verify connectivity to the new database.
    3. Click OK to create the data connection in Server Explorer/Database Explorer.
      Now you can expand the connection and right-click the Tables node to start creating new tables and designing the schema that defines the database.
    4. To add this database to your project, follow the directions for adding existing databases below.

      You can use the Add Existing Item dialog box to browse to an existing SQL Server Compact database file (.sdf) and add it to a project. You need to have an existing project loaded into the integrated development environment (IDE). After you add the database to your project, the Data Source Configuration Wizard automatically opens. You can then select the database objects (only tables in the case of SQL Server Compact) to add to the generated dataset that the wizard creates. After you complete the wizard, the tables are added to the Data Sources window, ready to be dropped onto forms to create data-bound controls.

      To add an existing SQL Server Compact database to a project

      1. On the Project menu, click Add Existing Item.
      2. In the Add Existing Item dialog box, browse to the location of the SQL Server Compact database file (.sdf) you want to use in the project, and then click Add.
        After you add the database file, the Data Source Configuration Wizard opens to the Choose your Database Objects page, and you can select the tables to use in the application.
         Note
        As an alternative to using the Add Existing Item dialog box, you can drag the .sdf file from File Explorer and drop it into your project in Solution Explorer.
      3. Expand the Tables node and select the tables you want to use in your application.
      4. Click Finish. The database is added to the project along with a typed dataset that includes the tables selected in the previous step. Additionally, the dataset appears in the Data Sources Window.
Newer Post
Previous
This is the last post.

0 comments:

Post a Comment