Syntax
| recordsetobject.AddNew [FieldList][, Values]
| ||||||
---|---|---|---|---|---|---|---|
Description
| Use 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.
| ||||||
See Also
| |||||||
Example
| 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 = "John"
strLastName = "Doe"
intAge = 826
...
rsData.AddNew
rsData.Fields("FirstName") = strFirstName
rsData.Fields("LastName") = strLastName
rsData.Fields("Age") = intAge
rsData.Update
|