android - Query only the first data from a table -
i'm trying query first data table.
cursor img_cursor = db.query( image_url_table_name, new string[]{"small_img_url" , "large_img_url"}, null", null, null, null, null);
could tell me how implement query first data retrieved table?
solution
i think solved answer:
cursor img_cursor = db.query( image_url_table_name, new string[]{"small_img_url" , "large_img_url"}, null", null, null, null, null , "1");
i used limit 1
first, application crashed. if pass number string
work. query has 8 parameters while we're using limit parameter.
limit 1
from documentation:
public cursor query (boolean distinct, string table, string[] columns, string selection, string[] selectionargs, string groupby, string having, string orderby, string limit)
so, put last argument "limit 1".
cursor img_cursor = db.query( image_url_table_name, new string[]{"small_img_url" , "large_img_url"}, null, null, null, null, "limit 1");
Comments
Post a Comment