mysql - SQLite Android - Table not found -


this question has answer here:

i have created 2 tables in sqlite android whenever running code says no tables found name, have tried on many devices still unable find errors in following code.

public void onopen(sqlitedatabase db) {     super.onopen(db); } @override public void oncreate(sqlitedatabase db) {     db.execsql("create table peoples" +             "(personid integer primary key autoincrement," +             " pname text," +             " pvehicle text," +             " ptime text," +             " pdate text," +             " startpoint text," +             " endpoint text)"); }  @override public void onupgrade(sqlitedatabase db, int oldversion, int newversion) {     db.execsql("drop table if exists peoples"); } public boolean insertpeoples(string pname,string pvehicle, string ptime, string pdate, string start, string end) {     try {          sqlitedatabase db = this.getwritabledatabase();         contentvalues values = new contentvalues();         values.put("pname",pname);         values.put("pvehicle",pvehicle);         values.put("ptime",ptime);         values.put("pdate",pdate);         values.put("startpoint",start);         values.put("endpoint",end);         db.insert("peoples",null,values);      }     catch (sqliteexception ex)     {         log.i("mylog",ex.getmessage());     }     return true; } public cursor getallpeoples() {     cursor res = null;     try {         sqlitedatabase database = this.getreadabledatabase();         res = database.rawquery("select * peoples",null);     }     catch (sqliteexception ex)     {         log.e("mylog",ex.getmessage());     }     return res; } public void deletepeoples() {     sqlitedatabase db = this.getwritabledatabase();     db.execsql("delete peoples"); } 

there table has similar code , working fine second table handled class , working fine code shows error no table found name peoples , returns null pointer exception while try records.

i think mistake in writing create table code. see this

 public static string createtable="create table details(_id integer primary key autoincrement,firstname text,lastname text,email text,contactno text)";  public void oncreate(sqlitedatabase db)  {     db.execsql(createtable);  } 

here letter "p" in primary key capital.


Comments