2

I've a database (BASE2.db) with 4 tables inside, but, when i want to delete the database i've an error:

the code:

db.execSQL("DROP DATABASE IF EXISTS BASE2.db");

the logcat:

(1) near "DATABASE": syntax error

I've try this, but not correct:

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

How to do this?

2 Answers 2

2

Try to use the following:

context.deleteDatabase(databaseName.db);
Sign up to request clarification or add additional context in comments.

1 Comment

but how to know the databsae path if the appli is moved to the sd card?
1

try this

this.deleteDatabase("databasename.db");

where this refers to your Activity, or any Context.

for more refer this blog

http://logcatsolutions.blogspot.in/2012/07/sqlite-complete-example-create.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.