ArcFM Responder Mobile Developer Guide
Compare Method (DbCompare)






First value to compare.
Second value to compare.
Compares two values and returns a value indicating whether one is less than, equal to or greater than the other in a type-agnotic and null/DBNull aware manner.
Syntax
'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)
public static System.int Compare( 
   System.object x,
   System.object y
)
public function Compare( 
    x: System.TObject;
    y: System.TObject
): System.Integer; static; 
public static function Compare( 
   x : System.Object,
   y : System.Object
) : System.int;
public: static System.int Compare( 
   System.Object* x,
   System.Object* y
) 
public:
static System.int Compare( 
   System.Object^ x,
   System.Object^ y
) 

Parameters

x
First value to compare.
y
Second value to compare.

Return Value

Values Conditions
Less than 0 x < y
Zero x == y
Greater than 1 x > y
Remarks

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:

Requirements

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

See Also

Reference

DbCompare Class
DbCompare Members
DbConvert Class

Send Feedback