Adding New Rows in the Results Pane

See Also

If the data in the Results pane can be modified, you can also add new rows to the table or tables represented by the result set.

Note   You cannot add BLOB or binary columns using the Query Designer.

The Query Designer 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 Designer might be able to enforce this restriction and might display an error message if you enter a negative value. On the other hand, if the column is defined in the database to accept prices in only a certain range (such as between 100 and 1000), the Query 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 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:

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 Windows® 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 Edit 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 does not automatically save your changes if you switch to another pane. If you edit the current query (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: