windows mobile - using SqlCEResultSet.Seek with composite keys in SQL Server CE -


can show me how can use sqlceresultset.seek method composite index?

i trying seek on orderno+product code.

my sql server ce table has 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 returns first matching order line.

thanks in advance

paul

the seek input data array must objects equate indexed fields. cannot seeok on field not in index. looks have index on order number , item, i'd think int , string, you're passing in "delnote" , item, both strings.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -