I'm having this error when I try to access one table:
02-19 16:46:01.677: E/AndroidRuntime(13159): android.database.sqlite.SQLiteException: no such table: notes: INSERT INTO notes (user,text) VALUES ('john','testingvalue')
But I created the table! I have two tables in the database ('users' and 'notes'), I'm accessing them the same way, but when I try to insert a value in the table 'notes', I have that error.
That's the code:
package com.loopr;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class SQL extends SQLiteOpenHelper {
String createUserTable = "CREATE TABLE users (name TEXT)";
String createNotesTable = "CREATE TABLE notes (user TEXT, text TEXT)";
public SQL(Context context, String name, CursorFactory factory, int version) {
super(context, name, factory, version);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(createNotesTable);
db.execSQL(createUserTable);
}
@Override
public void onUpgrade(SQLiteDatabase db, int before, int after) {
//Nothing at the moment
}
}
What can I do? Thanks.