gpt4 book ai didi

android - 要从 android SQlite 数据库中的表中删除所有记录?

转载 作者:太空狗 更新时间:2023-10-29 15:56:19 26 4
gpt4 key购买 nike

我想从数据库表中删除所有记录,但我无法删除。谁能帮帮我?

我正在使用此链接 Delete

   public void delete() 
{
String DELETEPASSCODE_DETAIL = "DELETE * FROM Payment;";
db.execSQL(DELETEPASSCODE_DETAIL);
}

我在这里调用删除函数

private void savepay() {
// TODO Auto-generated method stub
try{
String check;

webService calService=new webService();
dh.open();
Cursor c = dh.pay();


Toast.makeText(getBaseContext(),className+c.getString(1)+c.getString(2)+c.getString(3)+c.getString(4),Toast.LENGTH_LONG).show();
check= calService.paymentReceipt("PaymentReceipt",c.getString(1),c.getString(2),c.getString(3),c.getString(4),c.getString(5),"0");

}
while (c.moveToNext());
dh.delete();//here i called delete function
dh.close();



}

最佳答案

你的代码应该是这样的

public void delete() 
{
String DELETEPASSCODE_DETAIL = "DELETE FROM Payment;";
db.execSQL(DELETEPASSCODE_DETAIL);
}

关于android - 要从 android SQlite 数据库中的表中删除所有记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8667153/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com