0

I'm trying to read a Database which I've created and in the LogCat it appears: "Style contains key with bad entry: 0x01010479" and "(1) no such table: FeedReader". I have been testing a lot of hours and I don't know the problem

Context contexto = this;
        DataBase dbHelper=new DataBase(contexto);
        SQLiteDatabase db=dbHelper.getWritableDatabase();
        String[] columns={"COLUMNname","COLUMNimage","COLUMNsound"};
        Cursor c=db.query("FeedReader", null, null, null, null, null, null);
        if (c.moveToFirst()) {
            //Recorremos el cursor hasta que no haya más registros
            for(c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
                nameC[c.getCount()]= c.getString(1);
                //imageC[c.getCount()]= c.getString(2);
                //soundC[c.getCount()]= c.getString(3);
            }
        }
        c.close();
        db.close();
    }catch(SQLiteException e)
    { System.out.println(e.getMessage());}

Here is how I create the Database

public class DataBase extends SQLiteOpenHelper{

public static final int DATABASE_VERSION = 1;
public static final String nameDataBase = "FeedReader";

public String createEntires="CREATE TABLE dBsound(" +
    "id INTEGER PRIMARY KEY AUTOINCREMENT," +
    "COLUMNname TEXT,COLUMNimage TEXT,COLUMNsound TEXT)";
public String deleteEntires =
        "DROP TABLE IF EXISTS dBsound";

public DataBase(Context context) {
    super(context, nameDataBase, null, DATABASE_VERSION);
    // TODO Auto-generated constructor stub
}

@Override
public void onCreate(SQLiteDatabase db) {
    db.execSQL(createEntires);

}

@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    db.execSQL(deleteEntires);
    onCreate(db);
}


public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    onUpgrade(db, oldVersion, newVersion);
}

1 Answer 1

4

Actually your Table Name is dBsound. So do

 Cursor c=db.query("dBsound", null, null, null, null, null, null);

FeedReader is your Database Name.

Sign up to request clarification or add additional context in comments.

1 Comment

also the primary key is _id, not id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.