Version

UpdateActivity(Activity) Method

Modifies an Activity that already exists in the database.
Syntax
'Declaration
 
Public Overloads Sub UpdateActivity( _
   ByVal activity As Activity _
) 
public void UpdateActivity( 
   Activity activity
)

Parameters

activity
An initialized activity loaded from the data source.
Exceptions
ExceptionDescription
System.ArgumentNullExceptionThrown when the activity was supplied as a null reference (or Nothing in Visual Basic .NET). An Activity must be non-null to specify a DataKey and have property values with which to update the data store.
System.NotSupportedExceptionThrown when the concrete type of activity is something other than Appointment. Presently, only the update of Appointment objects into the data store is supported.
System.ComponentModel.WarningExceptionThrown when the WebScheduleInfo property has not been properly initialized before calling UpdateActivity. In order for UpdateActivity to modify the supplied activity in the data store, the WebScheduleDataProviderBase must already be initialized with the same WebScheduleInfo as the activity was.
Remarks

WebSchedule automatically handles updating an Activity when an end user directly edits it within the user interface. Developers would call UpdateActivity to persist changes their application makes to other copies of activities. Ordinarily, such changes would not be persistent.

The UpdateActivity method also supports administrative tasks an application might perform on a WebSchedule data store: such as moving all start times for appointments back one hour on a specific date, or marking all appointments more than one month old with Low Importance as an indication they can be deleted or archived.

The DataKey property of the specified activity is used to edit an existing row within the Activity data table. If a row having the DataKey as it's primary key does not already exist, then the UpdateActivity method fails.

The data provider cannot add the supplied activity as if it were a new row when it finds it doesn't exist, because it must respect the primary key constraints of the Activity table. In particular, the primary key may be an AutoNumber column for which direct assignment is unsupported (or potentially hazardous) in many relational database management systems.

No other properties on the Activity instance supplied to UpdateActivity are used as keys. Instead, all other properties (on which data binding is defined) are used as the source of values that update their corresponding columns in the existing row of the Activity table.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also