Routines (alphabetical) > Object Classes > Miscellaneous Object Classes > IDLdbRecordset::AddRecord

# IDLdbRecordset::AddRecord

Use the IDLdbRecordset::AddRecord procedure method to add a record to a recordset. If you don’t have permission to modify the recordset, an error is returned. The location in the recordset of the new record is dependent on the ODBC Driver, but in most cases it is added to the end of the recordset.

## Syntax

RSobj -> [IDLdbRecordset::]AddRecord[, field 1[, field 2[, ...[, field n]]]] [, SET_AUTOINCREMENT=integer]

## Arguments

Any arguments passed to this routine are used to initialize the new record. If these initialization parameters are not provided, the field is initialized to null. If the field cannot be set to null, it is initialized to 0.

## Keywords

### SET_AUTOINCREMENT

Normally when adding a record to the recordset, the DataMiner skips setting the values on autoincrement fields. By setting this keyword, the DataMiner will attempt to set the value of the autoincrement field with the value provided. Note that the results from setting an autoincrement field is datasource dependent and might result in an error.

Note: When using the cursor library, adding a new record to a table that only contains a single autoincrement field can result in an error. To add a record, either set the SET_AUTOINCREMENT keyword, or do not use an autoincrement field.

## Version History

5.0 | Introduced