>New CursorAdapter Functionality > >Visual FoxPro 8.0 Service Pack 1 contains additional properties for the CursorAdapter class to >better handle update conflicts. These include the ConflictCheckType and ConflictCheckCmd >properties. > >ConflictCheckType Property > >The ConflictCheckType property specifies how the conflict checks are handled during an update or >delete operation. Read/write at design time and run time. > >CursorAdapter.ConflictCheckType [ = nValue] > >Parameters > >nValue > >Specifies a value for determining how conflict checks are handled. The following table lists the values for nValue. > > > >nValue > > >Description > >0 Do not perform check. (Default) > >1 In a single row update mode, check for update conflicts during a SQL UPDATE or DELETE > operation. If conflict occurs, specifically, when less than one record is affected by any > command specified by UpdateCmd or DeleteCmd property, return error "Update conflict (Error > 1585)". >2 In a single row update mode, check for key uniqueness during a SQL UPDATE or DELETE > operation. If more than one record is affected by any command specified by the UpdateCmd or > DeleteCmd property, return message "Warning: The key defined by the KeyField property for > table "alias" is not unique. (Error 1495)" >3 Perform checks as specified by setting 1 and 2. >4 Append custom command specified by ConflectCheckCmd property to the commands in the UpdateCmd > and DeleteCmd properties. > > > >Remarks > >· ConflictCheckType and ConflictCheckCmd are used for native, ODBC, and ADO data sources. When >using ADO, the CursorAdapter should use an ADO Command object for the SQL UPDATE or DELETE >operation. Otherwise, Visual FoxPro disregards ConflictCheckType and ConflictCheckCmd. > >· When performing a batched TABLEUPDATE( ) operation, Visual FoxPro disregards settings 1, 2, and >3 for ConflictCheckType. > >· It is recommended that you do not use settings 1, 2, and 3 if the UpdateCmd and DeleteCmd >properties contain more than one command. In this scenario, the CursorAdapter behavior depends on >the ODBC driver or OLE DB Provider and might yield unexpected results. > >· Settings 1, 2, and 3 for ConflictCheckType might fail if the ODBC driver or OLE DB Provider is >unable to provide required functionality or if the functionality is disabled due to driver, >provider, or backend configuration. For example, SET NOCOUNT ON in SQL Server disables the >functionality and prevents the CursorAdapter from performing updates if ConflictCheckType is set >to 1, 2, or 3. > >ConflictCheckCmd Property > >The ConflictCheckCmd property specifies a string reference for a custom command when >ConflictCheckType property is set to 4. Read/write at design time and run time. > >CursorAdapter.ConflictCheckCmd [ = cValue] > >Parameters > >cValue > >Specifies a custom command string reference to append to the commands specified by the UpdateCmd >and DeleteCmd properties for checking update or delete conflicts. The default value for cValue is an empty string (""). > >Remarks > >See the Remarks section for ConflictCheckType. > >Example > >SQL Server: ConflictCheckCmd="IF @@ERROR=0 AND @@ROWCOUNT!=1 RAISERROR (' Update conflict or non-unique key.', 16, 1)" > >Native: ConflictCheckCmd="CheckConflict()" > >FUNCTION CheckConflict() > > IF _tally<1 > > ERROR(1585) > > ELSE > > IF _tally>1 > > ERROR(1495) > > ENDIF > > ENDIF > >ENDFUNC >