Table name has no column column name [closed]

0

I'm doing a project on Android and creating a b.d SQLite and in the class that extends SQLiteOpenHelper at the time of doing an insert I'm getting the following:

  

table stops has not column lng

But the table has the column. For syntax errors in the variable where the query is to create the table I missed 2 commas in the last 2 fields (lat and lng)

For the first one I solved it with the same method that I have been trying to solve the second: deleting data from the app on the mobile, uninstalling the mobile app and increasing the version number of bd but at this time It is not resulting. I do not know what else I should do to stay with the fields at the time of debugging or running the app.

Just in case I leave the variables of how is the sentence that creates the table:

// Table Names
private static final String TABLA_PARADAS = "paradas";

// Columnas tabla paradas
private static final String PARADAS_CODIGO = "cod";
private static final String PARADAS_LAT = "lat";
private static final String PARADAS_LNG = "lng";

// Columnas comunes
private static final String ID = "_id";
private static final String NOMBRE = "nombre";
private static final String DESC = "desc";

// Table Create Statements
// Create statement tabla paradas
private static final String CREATE_TABLE_PARADAS = "CREATE TABLE "
        + TABLA_PARADAS + " (" + ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + PARADAS_CODIGO + " TEXT,"
        + NOMBRE + " TEXT, " + DESC + " TEXT, " + PARADAS_LAT
        + " DOUBLE, " + PARADAS_LNG + "DOUBLE)";
    
asked by Néstor 14.03.2016 в 22:49
source

1 answer

3

You have an error here:

 + " DOUBLE, " + PARADAS_LNG + "DOUBLE)";

this is similar to:

 + " DOUBLE, lngDOUBLE)";

for that reason your query is incorrect and when you create the table the " lng " field does not exist, you must add a space:

 + " DOUBLE, " + PARADAS_LNG + " DOUBLE)";

An option to provoke the application to be generated again by means of the onCreate () method of SQLiteOpenHelper is to clean the data of your application:

  • Another option is that when increasing the version number you must run onUpgrade (), just ensure you have a DROP of the table so that you can generate the structure of the table again.
answered by 14.03.2016 / 23:01
source