开发者

How To delete a table

开发者 https://www.devze.com 2023-02-05 06:48 出处:网络
How do i delete a开发者_运维技巧 whole table in android through code?I\'d say just use a DROP TABLE query?

How do i delete a开发者_运维技巧 whole table in android through code?


I'd say just use a DROP TABLE query?

(I'm asuming you're talking about a database, and you're using the SQLite that's in Android, right? http://www.sqlite.org/lang_droptable.html )

an example as requested:

 DROP TABLE IF EXISTS mydatabase.myTable


You can delete a database easily by writing a test case inheriting from AndroidTestCase (You don't have to but its an option), that way you will get access to Context, and call deleteDatabase("mydatabase.db") on it.

0

精彩评论

暂无评论...
验证码 换一张
取 消