1

I have created a SQLite database & table in Android. After performing all the necessary calculations , I have deleted the data from the table of the database by calling the below code.

sampleDB.execSQL("DELETE FROM " + Constants.TABLE_NAME);

Now , I need to write a condition to check that if no data is there for that particular table , I need to show an Alert .

I am unable to find the code to check the condition whether data is there or not for the TABLE , maybe how to check the size of the data within the TABLE.

Kindly provide hints/sample code.

khant vyas
  • 123
  • 3
chiranjib
  • 5,288
  • 8
  • 53
  • 82
  • 1
    Duplicate http://stackoverflow.com/questions/4397757/how-can-i-check-to-see-if-my-sqlite-table-has-data-in-it – ccheneson Dec 27 '10 at 12:43

1 Answers1

1

Just query

SELECT COUNT(*) FROM table;
Martin v. Löwis
  • 124,830
  • 17
  • 198
  • 235