New Posts New Posts RSS Feed: Count of Records
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Count of Records

 Post Reply Post Reply
Author
bjmreddy View Drop Down
Newbie
Newbie


Joined: 22-Jun-2010
Posts: 3
Post Options Post Options   Quote bjmreddy Quote  Post ReplyReply Direct Link To This Post Topic: Count of Records
    Posted: 13-Jul-2010 at 7:38am
Hello All,
 
I am using silverlight with Ideablade in one of our applications, below is the ExecuteQueryAsync method to execute query, can you guys please help me how to get count of the records other than looping through results and counting.
 
below is the code I am using
 

_mgr.ExecuteQueryAsync(_mgr.Assets.Where(a => a.ParentID == customerid ) , GotAssets, null);

I tried to use
_mgr.ExecuteQueryAsync(_mgr.Assets.Where(a => a.ParentID == customerid ).Count() , GotAssets, null);
 
but it throws error.
 
Please help or point me to similar examples.
 
 
Thanks,
 
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 13-Jul-2010 at 6:38pm
Yes, it should look something like this:
 
var op = _mgr.Assets.Where(a => a.ParentID == customerid).AsScalarAsync().Count();
op.Completed += new EventHandler<EntityScalarQueriedEventArgs<int>>(op_Completed);
 
Back to Top
bjmreddy View Drop Down
Newbie
Newbie


Joined: 22-Jun-2010
Posts: 3
Post Options Post Options   Quote bjmreddy Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jul-2010 at 1:19pm
Thanks for reply,
I don't have AsScalarAsync as a option, am I missing somthing here?
 
thanks
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 14-Jul-2010 at 6:09pm
You are probably missing this:
using IdeaBlade.EntityModel;
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down