Jaa


Adding a Row by Using a Result Set Position

The ADO, OLE DB and ODBC APIs support adding rows while processing the result set of a query. The following steps describe the fundamental process:

  1. Bind the result set columns to program variables.
  2. Execute the query.
  3. Call API functions or methods to position the application on a row within the result set.
  4. Fill the bound program variables with the data values for the new row to be inserted.
  5. Call one of the following functions or methods to insert the row:
    • In ADO, call the AddNew method of the Recordset object.
    • In OLE DB, call the InsertRow method of the IRowsetChange interface.
    • In ODBC 3.x, call the SQLBulkOperations function with the SQL_ADD option.

The new row is not necessarily inserted at a position based on the position of the application within the result set. The new row is inserted at a position in the base tables related to the values of any clustered key values specified.

See Also

Concepts

Adding Rows by Using INSERT and SELECT
Adding ntext, text, or image Data to Inserted Rows
Adding Rows by Using Bulk Copy Operations

Help and Information

Getting SQL Server 2005 Assistance