When do you got this error? while doing an update/an insert? It is
your table successfully created? If it is, I would open my db from the
emulator with sqllite3 and see what I got (type ".table"), maybe there
is not such column. Once you have checked this, go further.
On Apr 8, 8:14 pm, "Megha Joshi" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Your code seems correct. Can you post the code in which you are invoking
> these methods , and mark the point at which you get the error?
>
> Thanks,
> Megha
>
> On Tue, Apr 8, 2008 at 10:01 AM, olivier.k <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > 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
-~----------~----~----~----~------~----~------~--~---