By the way, if I try to adda reference of Mono.Data.Sqlite it goes wrong, I
can't seem to find it :S

2011/9/15 Mittchel Van Vliet <mittc...@gmail.com>

> Thanks Jon, again.. haha:p
>
> I really appreciate your help since I'm really new to this stuff.. but the
> methods like WithCommand are just regually in there?
> Cause I have monodroid in visual studio but don't see any files like
> MonoDataSqlite.. Or is that just baked into the framework?
> Because if I am correct you wrote that controller yourself right?
>
> Where do you get the [Items] from in the sql statements?
>
> Regards,
>
> --Mittchel
>
> 2011/9/15 Jonathan Pryor <j...@xamarin.com>
>
>> On Sep 14, 2011, at 5:05 PM, Mittchel wrote:
>> > Why would you want to bundle it with your app? What are the pros and
>> cons?
>>
>> It would certainly be easier to ship a "pre-canned" version than to do it
>> in code (less/no duplication, etc.). It just has additional startup overhead
>> (do it in a separate thread ;-)
>>
>> > Could you maybe illustrate me a method that executes a simple select
>> query and returns the amount of rows? For say like a login method.. I tryed
>> to find methods for that in sqlite but didnt succeed..
>>
>> This was MonoTouch-specific, but the core SELECTs/etc. are cross-platform:
>>
>>
>> https://github.com/xamarin/monotouch-samples/blob/master/MonoCatalog-MonoDevelop/MonoDataSqlite.xib.cs
>>
>> Granted, it's using a WithCommand() helper, but the intent should be
>> clear. For example, to get an item count:
>>
>>        //
>> https://github.com/xamarin/monotouch-samples/blob/master/MonoCatalog-MonoDevelop/MonoDataSqlite.xib.cs#L211
>>        WithCommand (c => {
>>                c.CommandText = "SELECT COUNT(*) FROM [Items]";
>>                var r = c.ExecuteReader ();
>>                while (r.Read ()) {
>>                        count = (int) (long) r [0];
>>                }
>>        });
>>
>> To select data:
>>
>>        //
>> https://github.com/xamarin/monotouch-samples/blob/master/MonoCatalog-MonoDevelop/MonoDataSqlite.xib.cs#L162
>>        string query = string.Format ("SELECT [Key], [Value] FROM [Items]
>> LIMIT {0},1", indexPath.Row);
>>        string key = null, value = null;
>>        WithCommand (c => {
>>                c.CommandText = query;
>>                var r = c.ExecuteReader ();
>>                while (r.Read ()) {
>>                        key   = r ["Key"].ToString ();
>>                        value = r ["Value"].ToString ();
>>                }
>>        });
>>
>> It's ye-olde ADO.NET.
>>
>>  - Jon
>>
>> _______________________________________________
>> Monodroid mailing list
>> Monodroid@lists.ximian.com
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/mailman/listinfo/monodroid
>>
>
>
_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to