How to solve No such table error in Android Sqlite -


I have tried to add data to the following helper class, but I have not found 'such a table' error.

If we use normal SQL queries, then it starts working. But this kind of query is not working How to write these types of questions, please explain that syntax!

  Stable class EmpHelper Extended SQLiteOpenHelper {Personal Static Last String DATABASE_NAME = "empdatabase"; Private static final string TABLE_NAME = "emptable"; Personal Static FINAL END DATABASE_VERSION = 2; Private static final string UID = "_id"; Private Static Last String NAME = "Name"; Private static final string PASSWORD = "password"; Personal Static Last String CREATE_TABLE = "Create Table" + "TABLE_NAME +" ("+ UID +" integral primary key, "+ NAME +" VARCHAR (255), "+ password" + VARCHAR2 (255) "+"); Private static final string DROP_TABLE = "If present in empty tab" + TABLE_NAME; Personal reference references; Public EmpHelper (Reference Reference) {Super (Reference, DATABASE_NAME, Blank, Database_Version); This.context = context; Message.message (reference, called "constructor"); } @ Override Public Wide On Creation (SQLiteDatabase db) {// TODO Automated method stub {db.execSQL (CREATE_TABLE); } Grip (SQLException E) {// TODO Auto-Generated Catch Block e.printStackTrace (); }}    

There are several syntax problems with your create table SQL and you take exceptions in onCreate () . Therefore SQLiteOpenHelper thinks that the database creation was successful, even if the SQL was not executed.

To fix:

  • tab "" and TABLE_NAME .
  • Add space between PASSWORD and "VARCHAR" .
  • Remove hold . There is a need to throw exceptions to the call.
  • Uninstall your app so that old, empty databases are removed and onCreate () is run again.

    (For that case, the location is also missing in your DROP_TABLE .)

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -