You have to return a class (this bit me, too - I'm using sums)

class IntWrapper
{
  public int Count { get; set; }
}

 var list = Db.Con.Query<IntWrapper>("select count(*) as count from mytable");
return list[0].Count;

or something very similar to that :)


On Wed, May 23, 2012 at 10:16 AM, Guido Van Hoecke <[email protected]> wrote:
> Hi,
>
> I am happily using sqlite-net http://code.google.com/p/sqlite-net/ but
> need some help with the simple task to retrieve the count of records in
> a particular table.
>
> Here's what I do:
>
>        var list = Db.Con.Query<int>("select count(*) from mytable");
>        return list[0];
>
> When I issue this select at the sqlite3 prompt, it returns the correct
> nr of rows. Unfortunately sqlite-net always returns 0.
>
> Any ideas?
>
> Thanks in advance,
>
>
>
> Guido
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch



-- 
Nic Wise
t.  +44 7788 592 806 | @fastchicken | http://www.linkedin.com/in/nicwise
b. http://www.fastchicken.co.nz/

Earnest: Self-employed? Track your business expenses and income.
http://earnestapp.com
Nearest Bus: find when the next bus is coming to your stop. http://goo.gl/Vcz1p
mobileAgent (for FreeAgent): get your accounts in your pocket.
http://goo.gl/IuBU
Trip Wallet: Keep track of your budget on the go: http://goo.gl/ePhKa
London Bike App: Find the nearest Boris Bike, and get riding! http://goo.gl/Icp2
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to