warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in C:\inetpub\Websites\DevGuru\www\includes\common.inc(1762) : eval()'d code on line 1.

ADO » Recordset » AddNew

recordsetobject.AddNew  FieldList, Values
The optional Values parameter is a single value or an array of values for the fields that you want to populate in the new record. If the FieldList parameter is an array, then Values must also be an array. Further, Values must have the exact same number of members and be in the same order as FieldList.
The optional FieldList parameter is a variant that can be a single field name, or an array of field names, or the numeric (ordinal) position of the fields in the new record. For both the single name and array of names, each name must be enclosed within a pair of double quotes. Multiple names in the array must be separated (delimited) by commas.

Used to create a new record.

The AddNew method is called to create and initialize a new record that can be added to an updateable Recordset. The provider must support adding new records.

There are two optional parameters.

Since the parameters are optional, there are two ways to use the AddNew method, with or without the arguments. If you do not use parameters, then you will need to call the Update or UpdateBatch methods. When you use the optional parameters, ADO will automatically perform the update. However, if you are doing batch updates, you will still need to call the UpdateBatch method.


MyObject.AddNew "FirstName", "Sasha"
MyObject.AddNew Array("FirstName", "LastName"), Array("Luke", "Skywalker")
varFieldList = Array("FirstName", "LastName")
varValues = Array("Luke", "Skywalker")
MyObject.AddNew varFieldList, varValues
strFirstName = "The"
strLastName = "Guru"
intAge = 826
rsGuruData.Fields("FirstName") = strFirstName
rsGuruData.Fields("LastName") = strLastName
rsGuruData.Fields("Age") = intAge

See Also: