Purpose of updateRow(T) and updateRow(T,T)?

net

(datagrafikk) #1

Hi,

We want to access all DataTable fields in OldValues not just fields from primary key.

After som testing it seems OldValues only contain values from primary key when using updateRow(T) or in our specific case, DABindingList.
To have OldValues contain other field values from DataTable we need to use updateRow(T,T)

How can we include OldValues in all DeltaChanges without having to manually call updateRow(T,T)?


(antonk) #2

Hello

What for you do need this data?

Override data adapter’s method UpdateRow<T>(T) called by the DABindingList and call the UpdateRow<T>(T, T) method.

You’ll need to store the original values somewhere when data is loaded. Notethat thil will double the memory consumed by loaded data.

Regards


(datagrafikk) #3

Hello Anton,

We need it to write update commands for businessprocessor on serverside to update records on more conditions than just primary key.

Example:

UPDATE
    v_dgAssignment

SET
    ActivityStartTimeActual = :ActivityStartTimeActual,
    ActivityStopTimeActual = :ActivityStopTimeActual,
    ActivityHoursActual = :ActivityHoursActual,
    ActivityHoursWithPax = :ActivityHoursWithPax,
    ActivityDistanceActual = :ActivityDistanceActual,
    ActivityDistanceWithPax = :ActivityDistanceWithPax,
    ActivityMileageGarage = :ActivityMileageGarage,
    ActivityMileageStart = :ActivityMileageStart,
    ActivityMileageStop = :ActivityMileageStop,
    ActivityMileageReturnGarage = :ActivityMileageReturnGarage,
    ActivityLastChangedByUserID = {CurrentUserId},
    ReportingFinished = :ReportingFinished,
    DriverID = :DriverID,
    VehicleID = :VehicleID,
    DeviationTypeID = :DeviationTypeId,
    DeviationRemark = :DeviationRemark,
    ActivityPaxActual = :ActivityPaxActual,
    ActivityGarageTimeActual = :ActivityGarageTimeActual,    
    ActivityPreStartTimeActual = :ActivityPreStartTimeActual,
    ActivityReturnGarageTimeActual = :ActivityReturnGarageTimeActual,
    ResponseState = :ResponseState,
    ResponseTimeStamp = :ResponseTimeStamp

WHERE
    (ActivityID = :OLD_ActivityID)
    AND (ActivityLastChangedDate = :OLD_ActivityLastChangedDate)

ActivityLastChangedDate is a field in the DataTable and we tried a lot of different things to have OLD_ActivityLastChangedDate be available in the query. The only way we found (other than have the field as part of primary key) was to use the overloaded call to updateRow.

We would prefer not to do this on the client side at all but that the original record value available to us in business processor/update command.

Is there a better way to achieve this?