Hi all, just to start I'm working on my application for the android
challenge for 2 months. Tutorial has been done successfully and
another thing I'm a C/C++ developper.
I'm stuck with this issue for 1 week, I have done many thing but I
can't find the error ! Maybe the error is so big that I can't see it,
well if someone see ;)

Here is my code :

public static final String KEY_NAME             = "name";
    public static final String KEY_TYPE         = "type";
    public static final String KEY_FILTER       = "rfilter";
    public static final String KEY_ROWID        = "_id";

    private static final String DATABASE_CREATE1 =
        "create table things (_id integer primary key autoincrement,"
            + "name text not null, type integer not null, rfilter
integer not null);";

    private static final String DATABASE_NAME = "data";
    private static final String DATABASE_TABLE = "things";
    private static final int DATABASE_VERSION = 2;

    private SQLiteDatabase mDb;
    private final Context mCtx;

    public ThingDbAdapter(Context ctx) {
        this.mCtx = ctx;
    }

    public ThingDbAdapter open() throws SQLException {
        try {
            mDb = mCtx.openDatabase(DATABASE_NAME, null);
        } catch (FileNotFoundException e) {
            try {
                mDb = mCtx.createDatabase(DATABASE_NAME,
DATABASE_VERSION, 0, null);
                mDb.execSQL(DATABASE_CREATE1);
            } catch (FileNotFoundException e1) {
                throw new SQLException("Could not create database");
            }
        }
        return this;
    }

    public void close() {
        mDb.close();
    }

    public long createNote(String name, int type, int rfilter) {
        ContentValues initialValues = new ContentValues();
        initialValues.put(KEY_NAME, name);
        initialValues.put(KEY_TYPE, type);
        initialValues.put(KEY_FILTER, rfilter);
        return mDb.insert(DATABASE_TABLE, null, initialValues);
    }

    public boolean deleteNote(long rowId) {
        return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId,
null) > 0;
    }

    public Cursor fetchAllNotes() {
        return mDb.query(DATABASE_TABLE, new String[] {
                KEY_ROWID, KEY_NAME, KEY_TYPE, KEY_FILTER}, null,
null, null, null, null);
    }

    public Cursor fetchNote(long rowId) throws SQLException {
        Cursor result = mDb.query(true, DATABASE_TABLE, new String[] {
                KEY_ROWID, KEY_NAME, KEY_TYPE, KEY_FILTER}, KEY_ROWID
+ "=" + rowId, null, null,
                null, null);
        if ((result.count() == 0) || !result.first()) {
            throw new SQLException("No note matching ID: " + rowId);
        }
        return result;
    }

    public boolean updateNote(long rowId, String name, int type, int
rfilter) {
        ContentValues args = new ContentValues();
        args.put(KEY_NAME, name);
        args.put(KEY_TYPE, type);
        args.put(KEY_FILTER, rfilter);
        return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" +
rowId, null) > 0;
    }

As you can see I respect totaly the Notepad tutorial. And I'm having
this error :
SQLException no such column rfilter.

Why is the rfilter column missing. I have created this column
previously !!
Please help a desperate C/C++ programmer :)

Kind Regards,
Olivier K.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to