[MonoTouch] SQLite iOS binding to UITableView
Nic Wise
nicw at fastchicken.co.nz
Fri Mar 16 17:15:21 UTC 2012
I'd suggest you look at MonoTouch.Dialog for tableviews (after doing
some of the "raw" ones in a sample project, so you have an idea of how
they work under the hood)
And for Sqlite, I prefer Sqlite-net, tho I've found recently that
sometimes I shouldn't just load all the records and use linq to filter
them - using a query is way quicker :)
eg
var inc = conn.Query<DoubleObj>("select sum(Amount) as AmountSum from
\"Transaction\" where Direction = ? and TransactionDate between ? and
?",
(int)TransactionDirection.Income,
taxSettings.StartDate,
taxSettings.EndDate).FirstOrDefault ();
is good.
var total = (from t in conn.Table<Transaction>() where .... select
t.Amount).Sum();
is VERY VERY bad if you have 3000+ records (it loads each one into an
object, and then sums it - 24ms vrs 2000ms)
So, remember it's a SQL database, but use it like an ORM most of the time :)
On Fri, Mar 16, 2012 at 16:52, JonW <jonw at dialacab.co.uk> wrote:
> Hi there. I've been playing with MonoTouch on a Mac for a few days and whilst
> I'm getting there with several things (web services, customising the view
> controllers etc) I am having real issues with SQLite. First off, there are
> several types of data consumption via SQLite referred to in samples and on
> other websites (SQLite-Net, Vici, MonoTouch.Data etc) - which is the
> simplest method? Basically, my app will contain UITableViews and text boxes
> and I want to be able to create my database (unless it already exists),
> create tables (unless they already exist) and populate them on button click,
> bind UITableViews to queries (like I would bind GridViews in .Net), update
> and delete from them by Id. Any suggestions of a good, fully working example
> of how to do this? I'm pulling my hair out here!
>
> Another example I need is how to bind UITableViews to the output from my
> consumed .Net web services.
>
> Thank you for any help :-)
>
> Jon
>
> --
> View this message in context: http://monotouch.2284126.n4.nabble.com/SQLite-iOS-binding-to-UITableView-tp4478704p4478704.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> 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/
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
More information about the MonoTouch
mailing list