Options that specify how to Seek on an index.
This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
[Visual Basic] <Flags> <Serializable> Public Enum DbSeekOptions [C#] [Flags] [Serializable] public enum DbSeekOptions [C++] [Flags] [Serializable] __value public enum DbSeekOptions [JScript] public Flags Serializable enum DbSeekOptions
| Member name | Description | Value |
|---|---|---|
| After
Supported only by the .NET Compact Framework. |
Advances to the first row with values after the seek value, in index order. | 8 |
| AfterEqual
Supported only by the .NET Compact Framework. |
Advances to the last matching row on the index. If there are no matching rows, advances to the first row with values after the seek value, in index order. | 4 |
| Before
Supported only by the .NET Compact Framework. |
Advances to the last row with values before the seek value, in index order. | 32 |
| BeforeEqual
Supported only by the .NET Compact Framework. |
Advances to the first matching row on the index. If there are no matching rows, advances to the last row with values before the seek value, in index order. | 16 |
| FirstEqual
Supported only by the .NET Compact Framework. |
Advances to the first matching row on the index, in index order. | 1 |
| LastEqual
Supported only by the .NET Compact Framework. |
Advances to the last matching row on the index, in index order. | 2 |
[Visual Basic, C#] In this example, the AfterEqual option is specified for the Seek operation on the index.
[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
in the upper-left corner of the page.
Namespace: System.Data.SqlServerCe
Platforms: .NET Compact Framework - Windows CE .NET
Assembly: System.Data.Sqlserverce (in System.Data.Sqlserverce.dll)