Android SQL:从 SQL 数据库查找并删除项目
我不知道如何...首先,通过搜索字符串从 SQL 数据库中查找项目,然后删除找到的项目。我的数据库只是一个字符串列表。我已经找到了如何列出项目,但我不知道如何从中删除某些项目....
I can't find out how to... first, find an item from an SQL database by searching for a string, and then deleting that found item. My database is just a list of strings. I have found out how to list the items, but I am not sure how to delete certain items from it....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用DELETE语句:
小心
测试查询是否会通过更改来删除您想要的内容使用 DELETE 版本之前的 SELECT:
您可能需要指定更多详细信息来隔离所需的记录。
Use the DELETE statement:
Be careful
Test that the query will remove what you want it to by changing it to a SELECT before using the DELETE version:
You might need to specify more details to isolate the record you want.
在不确切了解您的表等的情况下,我有 此链接给您。
首先,您将给出表的名称,接下来您将传递类似
和作为 where-args 的内容,您将在字符串数组中传递您要查找的字符串。
最安全的方法是为每一行提供唯一的标识符(主键)。所以你一定会删除正确的记录。
Without knowing exactly about your tables etc. I have this link for you.
First you will give in the name of your table next you pass in something like
and as where-args you pass in a stringarray with the string you want to look for.
The safest way will be to give unique identifiers(primary keys) to each row. so you will be sure to delete the right record.