title: using SqlCEResultSet.Seek with composite keys in SQL Server CE
body: <p>Can someone show me how I can use the <code>SqlCeResultSet.Seek</code> method with a composite index?</p>
  
  <p>I am trying to seek on <code>orderno+product code</code>.</p>
  
  <p>My SQL Server CE table has the following index:</p>
  
  <pre><code>CREATE INDEX orderline_idx ON OrderLines (orderno, item)
  </code></pre>
  
  <p>My seek code is</p>
  
  <pre><code>public bool SeekDeliveryLine(string delnote,string item)
  {
          bool isFound = false;
  
          cmd = new SqlCeCommand();
          cmd.Connection = conn;
          cmd.CommandType = CommandType.TableDirect;
          cmd.CommandText = "OrderLines";
          cmd.IndexName = "orderline_idx ";
  
          try
          {
              //cmd.SetRange(DbRangeOptions.Match, new object[] { delnote }, null);
              deliveryRS = cmd.ExecuteResultSet(ResultSetOptions.Scrollable | ResultSetOptions.Updatable);
              isFound = deliveryRS.Seek(DbSeekOptions.FirstEqual, new object[] { delnote, item });
  
              if (isFound)
              {
                  deliveryRS.Read();
                  currentRowData = this.RetrieveRecord();
              }
          }
          catch (Exception ex)
          {
              MessageBox.Show(ex.Message);
          }
          return isFound;
      }
  </code></pre>
  
  <p>The code always returns the first matching order line.</p>
  
  <p>Thanks in advance </p>
  
  <p>Paul</p>