如何使用的String [] selectionArgs两个在SQLiteDatabase.query()如何使用、两个、String、selectionArgs

2023-09-05 08:25:00 作者:苍白无力旳爱

我如何使用 selectionArgs两个 字符串查询()?我希望我可以将其设置为,因为我没有使用它。我只是试图从数据库加载整个无序,未分组表成光标

How do I use the selectionArgs String in 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, ungrouped table from a database into a Cursor.

推荐答案

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);

至于你的问题 - 你可以使用空

as for your question - you can use null