Help Center

CADORecordset.Updatemethod

Saves any changes you make to the current row of a `Recordset` object.

DatabasesmethodCADORecordset.incdocumented

Syntax

FUNCTION Update ( BYREF dvFieldList AS DVARIANT = TYPE(VT_ERROR,0,0,0,DISP_E_PARAMNOTFOUND), BYREF dvValues AS DVARIANT = TYPE(VT_ERROR,0,0,0,DISP_E_PARAMNOTFOUND) ) AS HRESULT

Parameters

NameDescription
dvFieldListOptional. A Variant that represents a single name, or a Variant array that represents names or ordinal positions of the field or fields you wish to modify.
dvValuesOptional. A Variant that represents a single value, or a Variant array that represents values for the field or fields in the new record.

Return value

S_OK (0) or an HRESULT code.

Description

Saves any changes you make to the current row of a Recordset object.

Example

#include "AfxNova/CADODB.inc" USING AfxNova

' // Create a Connection object DIM pConnection AS CAdoConnection ' // Create a Recordset object DIM pRecordset AS CAdoRecordset

' // Open the connection DIM dvConStr AS DVARIANT = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=biblio.mdb" pConnection.Open dvConStr

' // Open the recordset DIM dvSource AS DVARIANT = "Publishers" DIM hr AS HRESULT = pRecordset.Open(dvSource, pConnection, adOpenKeyset, adLockOptimistic, adCmdTableDirect)

' // Add a new record pRecordset.AddNew pRecordset.Collect("PubID") = CLNG(10000) pRecordset.Collect("Name") = "Wile E. Coyote" pRecordset.Collect("Company Name") = "Warner Brothers Studios" pRecordset.Collect("Address") = "4000 Warner Boulevard" pRecordset.Collect("City") = "Burbank, CA. 91522" pRecordset.Update

' // === Close the recordset and the connection ' // If you don't close them, they will be closed when the application ends pRecordset.Close pConnection.Close

Reference

  • Include file CADORecordset.inc
  • Defined in AfxNova/CAdoRecordset.inc:1107
  • Documented in Databases/ADO Classes/CAdoRecordset Class.md
  • Topic: CADORecordset Class