Adding New Rows in the Results Pane

Visual Database Tools

Visual Database Tools

Adding New Rows in the Results Pane

If the data in the Results pane can be modified, you can also add new rows.

Note   You cannot add BLOB or binary columns using the Results pane.

The Query and View Designers can perform only simple data validation on the data you enter in the Results pane. For example, if the price column of the titles table accepts only positive values, the Query or View Designer might be able to enforce this restriction and might display an error message if you enter a negative value. But if the column is defined in the database to accept prices in only a certain range (such as between 100 and 1000), the Query or View Designer cannot enforce this restriction. When you save a row, the database will display an error message if any column in the row contains invalid data.

When you add a row, some columns might be filled in by default values or triggers. In many cases the Query Designer or View Designer can refresh the display of the new row to show you the automatically generated values. However, rows cannot be refreshed if the row's primary key:

  • Is not part of the result set.

  • Is generated automatically.

  • Is modified by a trigger.

In these cases, if you want to see the row as it is stored in the database, you must re-execute the query. Even then, however, the new row might not appear if it does not match the search conditions in the query you execute.

You can add new data either by typing it in or by pasting it from the Clipboard. A row to be pasted must have exactly the same number and types of columns as the table into which you are pasting. You can paste multiple rows into the Results pane at once.

To add a new data row

  1. Navigate to the bottom of the Results pane, where a blank row is available for adding a new data row.

    Tip   You can jump from anywhere in the Results pane to the bottom by pressing INS or right-clicking the Results pane, and then choosing New.

  2. If you are pasting rows from the Clipboard, select the new row by clicking the button to its left.

  3. Enter the data for the new row. If you are pasting, choose Paste from the shortcut menu.

    Tip   To enter null into a cell, press CTRL+0.

  4. Save the new row by moving to another row in the grid.

    Note   The Query Designer or View Designer does not automatically save your changes if you switch to another pane. If you edit the current query or view (for example, by making a change in the Grid pane), the Results pane is dimmed. However, it is still active, and you can still edit and save the row on which you had been working.

If an error occurs when you save the row (for example, you left a column blank that does not accept null values), the Query Designer displays the error message provided by the database, and then returns you to the row you were editing. You can then:

  • Resolve the error by making further edits in the row.

  • Cancel the edit by pressing ESC. If you press ESC while in a cell that you changed, the changes for that cell are canceled. If you press ESC while in a cell you have not changed, the changes for the entire row are canceled.

See Also

Deleting Rows in the Results Pane | Editing Rows in the Results Pane | Navigating in the Query Designer | Rules for Updating Results