[英]I can't delete selected id data from database in kotlin
What should I do at this stage to delete the selected id?这个阶段我应该怎么做才能删除选中的id? I tried all the ways I could think of.
我尝试了所有我能想到的方法。 thanks
谢谢
val db = this.writableDatabase
db.delete(table_name, null, null)
val db = this.writableDatabase
db.delete(table_name, "$col_id=?", arrayOf(itemId.toString()) )
Toast.makeText(context, "Silindi", Toast.LENGTH_LONG).show()
db.close()
Try executing a delete query like this尝试执行这样的删除查询
val sql = "DELETE FROM $table_name WHERE $col_id = $itemId"
db.execSQL(sql)
Then show the Toast message to indicate that the item has been deleted, and close the database connection afterwards.然后显示 Toast 消息表明该项目已被删除,然后关闭数据库连接。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.