在Java中,我怎么能删除SQLite表? [英] In java, how can I delete a sqlite table?

查看:370
本文介绍了在Java中,我怎么能删除SQLite表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Android应用程序。我要发展我的活动XML按钮,构建我的SQLite数据库和表。我怎能让用户preSS一个按钮来删除表?谢谢你。

I am developing android app. I have to develop a xml button in my activity, and construct my sqlite database and tables. How can I just let user press a button to delete a table? Thanks.

推荐答案

很难回答没有更多的情况下,但最终的sqlite的查询是:

Hard to answer without more context, but the ultimate sqlite query would be:

db.execSQL("DROP TABLE IF EXISTS table_name");

其中db是一个SqliteDatabase对象的引用。

Where db is a reference to a SqliteDatabase object.

这篇关于在Java中,我怎么能删除SQLite表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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