.NET Framework Class Library  

DbRangeOptions Enumeration

Note: This namespace, class, or member is supported only in version 1.1 of the .NET Framework.

Options used by SetRange when specifying the index range over which to Seek.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

[Visual Basic]
<Flags>
<Serializable>
Public Enum DbRangeOptions
[C#]
[Flags]
[Serializable]
public enum DbRangeOptions
[C++]
[Flags]
[Serializable]
__value public enum DbRangeOptions
[JScript]
public
   Flags
   Serializable
enum DbRangeOptions

Remarks

When specifying the Match or Prefix options, the endData value must be null.

You cannot combine the Match and ExcludeNulls options.

Members

Member name Description Value
Default

Supported only by the .NET Compact Framework.

Equivalent to InclusiveStart | InclusiveEnd. 0
ExcludeNulls

Supported only by the .NET Compact Framework.

Excludes null values from the range. 4
ExclusiveEnd

Supported only by the .NET Compact Framework.

Excludes the endData value from the range. 2
ExclusiveStart

Supported only by the .NET Compact Framework.

Excludes the startData value from the range. 1
InclusiveEnd

Supported only by the .NET Compact Framework.

Includes the endData value in the range. 0
InclusiveStart

Supported only by the .NET Compact Framework.

Includes the startData value in the range. 0
Match

Supported only by the .NET Compact Framework.

Specifies a range where index values match the value of startData. In this case, endData must be set to null. 16
Prefix

Supported only by the .NET Compact Framework.

Specifies a range where index values begin with the value of startData. In this case, endData must be set to null. 8

Example

[Visual Basic, C#] In this example, the range options for the Seek operation on the index are specified as InclusiveStart and InclusiveEnd when calling the SetRange method.

[Visual Basic] 
Public Sub CreateMySqlCeCommand(conn As SqlCeConnection)
   Dim cmd As SqlCeCommand = conn.CreateCommand()
   
   cmd.CommandType = CommandType.TableDirect
   
   'This is the name of the base table 
   cmd.CommandText = "Orders"
   
   'Assume: Index contains three columns [int, datetime, money]
   cmd.IndexName = "SomeIndex"
   
   Dim start(3) As Object
   Dim [end](1) As Object
   
   start(0) = 1
   start(1) = New SqlDateTime(1996, 1, 1)
   start(2) = New SqlMoney(10.0)
   
   [end](0) = 5
   
   cmd.SetRange(DbRangeOptions.InclusiveStart Or DbRangeOptions.InclusiveEnd, start, [end])
   
   Dim rdr As SqlCeDataReader = cmd.ExecuteReader()
   rdr.Seek(DbSeekOptions.AfterEqual, 1, New SqlDateTime(1997, 1, 1), New SqlMoney(10.5))
   
   While rdr.Read()
   End While ' Read data in the usual way    
   rdr.Close()
End Sub 

[C#] 
public void CreateMySqlCeCommand(SqlCeConnection conn) {
    SqlCeCommand cmd = conn.CreateCommand();
    cmd.CommandType  = CommandType.TableDirect;
    
    // This is the name of the base table 
    cmd.CommandText  = "Orders";

    //Assume: Index contains three columns [int, datetime, money]
    cmd.IndexName    = "SomeIndex"; 
            
    object[] start = new object[3];
    object[] end   = new object[1];
                
    start[0] = 1;
    start[1] = new SqlDateTime(1996, 1, 1);
    start[2] = new SqlMoney(10.00);
            
    end[0]   = 5;

    cmd.SetRange(DbRangeOptions.InclusiveStart | DbRangeOptions.InclusiveEnd, start, end); 
    
    SqlCeDataReader rdr = cmd.ExecuteReader();             
    rdr.Seek(DbSeekOptions.AfterEqual, 1, new SqlDateTime(1997, 1,1), new SqlMoney(10.50));
            
    while(rdr.Read()) {
        // Read data in the usual way    
    }
    rdr.Close();
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Data.SqlServerCe

Platforms: .NET Compact Framework - Windows CE .NET

Assembly: System.Data.Sqlserverce (in System.Data.Sqlserverce.dll)

See Also

System.Data.SqlServerCe Namespace