Name
AddNew (Recordset Object) —
rsObj
.AddNew
FieldName(s)
,
FieldValue(s)
Synopsis
Creates
and initializes a new record in the
underlying database. To determine whether the underlying data
provider supports this functionality, call the Supports method of the
Recordset with the ADO adAddNew constant as an
argument. If the resulting value is True, then you
can use AddNew.
Parameters
-
FieldName(s) The name of a single field in the new record, or the name of an array containing the names of multiple fields in the new record. If
FieldName(s)is the name of a field name array, you must also pass the name of a value array, and the number of elements for both arrays must be the same or an error occurs.-
FieldValue(s) The value of a single field in the new record or the name of an array containing the values of multiple fields in the new record. If
FieldValue(s)is a value array,FieldName(s)must be the name of a field name array, and the number of elements for both arrays must be the same or an error occurs.
Example
The following example demonstrates the use of the AddNew method both without and with arguments.
<%@ LANGUAGE="VBSCRIPT" %> <% Response.Buffer = True %> <HTML> <HEAD> <TITLE>ADO Examples</TITLE> </HEAD> <BODY> <% ' Include ADOVBS.INC so we can use the ADO constants. %> <!-- #include virtual = "/MySSIncludes/adovbs.inc" --> <% Dim astrFieldNames( ) Dim astrFieldValues( ) ' Instantiate an ADO Connection object. Set objDBConn = Server.CreateObject("ADODB.Connection") ' Construct ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access