[This is preliminary documentation and subject to change]

## Add/Delete Records

###### Overview

This sample illustrates the techniques you need to know in order to use ASP and ADO to add and delete records from a database.

###### Code Tour

First, CreateObject is used to create an instance of the Connection object, which in turn is used to open a connection to the OLE DB data provider. CreateObject is used again, this time to create an empty Recordset object. The ActiveConnection property is set to refer to the new Connection object.

Although the ADO Recordset object provides the AddNew method to add new records to a database, you may be able to achieve better scalability by sending SQL INSERT commands directly to the database engine. This sample uses the Recordset.Execute command, with the appropriate SQL command string, to insert information for a new author.

At this point, another Recordset object instance is created and opened with another SQL command. The record just added is selected, then deleted by passing the SQL DELETE command directly to the database engine. The script then terminates.

Important OLE DB must be properly configured on the server for this sample to run properly.

© 1997-2001 Microsoft Corporation. All rights reserved.