sql server ce - How to get the maximum value from local database in windows phone? -


i need maximum value table should belongs particular category. code follows :

 private int gethighscores(int _playmode)     {         int maxscore = 0;         using (hangmanscoredatacontext hangmandb = new hangmanscoredatacontext(@"isostore:/hangmanscoredb.sdf"))         {             iqueryable<tblehangmanscore> sqlquery = hangmandb._tblehangman;             sqlquery = sqlquery.where(p => p.playmode == _playmode);                              maxscore = sqlquery.asqueryable().max(p => p.score);          }         return maxscore;     } 

i getting error

an unhandled exception of type 'system.stackoverflowexception' occurred in unknown module. except maximum value rest of things working . how can solve issue ?

edit : problem arises when table contains 0 numbers of records. same problem when trying minimum value also.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -