Tuesday, August 16, 2011

[android-developers] Re: Help! How to query a database?

I like the raw query:


String sql = "SELECT * FROM tableName";

Cursor c = mDb.rawQuery(sql, null);


I can see my sql statements better than the helper function "query"

Also if you use eclipse and run the debugger, you can see the sql
built from the query function
inside your cursor variable

On Aug 14, 12:27 pm, Ace Zhu <zhujianjia.b...@gmail.com> wrote:
> I use the follow code to query a database. But it return a null value.
> Can you tell me why?
> Thanks.
> "Cursor cursor = db.query("tableName", new String[]{"title"}, null,
> null, null, null, null);"
> Why cursor is null?

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment