在SQLiteDatabase.query()中使用String [] selectionArgs [英] Using String[] selectionArgs in SQLiteDatabase.query()

查看:500
本文介绍了在SQLiteDatabase.query()中使用String [] selectionArgs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在SQLiteDatabase.query()中使用String[] selectionArgs?我希望我可以将其设置为null,因为我没有用.我只是试图将整个未排序的表从数据库加载到Cursor中.关于如何实现这一目标的任何建议?

How do I use the String[] selectionArgs in SQLiteDatabase.query()? I wish I could just set it to null, as I have no use for it. I am just trying to load an entire unsorted table from a database into a Cursor. Any suggestions on how to achieve this?

推荐答案

selectionArgs替换选择字符串中的所有问号.

selectionArgs replace any question marks in the selection string.

例如:

String[] args = { "first string", "second@string.com" };
Cursor cursor = db.query("TABLE_NAME", null, "name=? AND email=?", args, null);

关于您的问题-您可以使用null

as for your question - you can use null

这篇关于在SQLiteDatabase.query()中使用String [] selectionArgs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆