I have a database with several fields of various types (basically String, Integer and Decimal). I'd like to create a control field to store something like a checksum in order to detect simple value changes from any among those fields.
I first thought of collecting .GetHashCode
from each field value just before calling INSERT INTO against the database, and performing some arithmetical operation complex enough to be difficult form someone to manually replicate, and putting this result as value for the control field:
Function ControlFieldValue(ParamArray values() As IEnumerable(Of Object)) As Long
Dim retval As Long
For Each v In values
If retval = 0 Then
retval = v.GetHashCode
Else
retval = retval Mod v.GetHashCode
End If
Next
Return retval
End Function
But I don't know how effective this would be. Is there some simple implementation in VB.NET for such purpose? Thank you very much.