Miner.Data.Access Namespace > DbCompare Class : Compare Method |
'Declaration
Public Shared Function Compare( _ ByVal x As System.Object, _ ByVal y As System.Object _ ) As System.Integer
'Usage
Dim x As System.Object Dim y As System.Object Dim value As System.Integer value = DbCompare.Compare(x, y)
Values | Conditions |
---|---|
Less than 0 | x < y |
Zero | x == y |
Greater than 1 | x > y |
The values are converted into equivalent types before the comparison so that the result is type-agnostic (in this context we mean that the values of different types as not considered different just because of their type):
DbCompare.Compare((int)1, (decimal)1); // returns 0; DbCompare.Compare((int)1, "1"); // returns 0; DbCompare.Compare(true, "true"); // returns 0;
In order to use this function correctly it is important to understand its handling of null and DBNull. The following are some assumptions made by the Compare function and therefore the more specialized functions that are based upon it:
Target Platforms: 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