Extracts the fields to save to the database from the objItem.SaveFields function. The fields are then written to the database using either an SQL INSERT or UPDATE depending on whether the object has already been saved. If the collection has implemented IDatabaseObjects.KeyFieldName then objItem's key is also validated to ensure it is not null and unique within the collection. If the parent collection has implemented Subset then this object should exist within the parent collection. If not, a duplicate key error may occur if the key is being used in another subset in the same table. If a record is being amended (MyBase.IsSaved is True) then the function will "AND" the parent collection's Subset conditions and the DistinctValue value to create the WHERE clause in the UPDATE statement. Therefore, the combination of the IDatabaseObjects.Subset and IDatabaseObject.DistinctValue conditions MUST identify only one record in the table. Otherwise multiple records will be updated with the same data. If data is only inserted and not amended (usually a rare occurance) then this requirement is unnecessary.

Namespace: DatabaseObjects
Assembly: DatabaseObjects (in DatabaseObjects.dll) Version: 3.8.1.0

Syntax

C#
protected virtual void Save()
Visual Basic
Protected Overridable Sub Save
Visual C++
protected:
virtual void Save()

Examples

CopyC#
'Make the inherited "Protected Sub Save" public
Public Overrides Sub Save()

    MyBase.Save()

End Sub

See Also