Hi
can someone show me how I can use the SqlCeResultSet.Seek method with a composite index?
I am trying to seek on orderno+product code
my sqlce table has the following index: CREATE INDEX orderline_idx ON OrderLines ( orderno,item )
My seek code is
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;
}
The code always returns the first matching order line.
Thanks in advance Paul