Hello,

I have wrote the code to create and write the table. But it is giving
the following exception.

android.database.sqlite.SQLiteException: no such table: inbox
1: , while compiling: INSERT INTO inbox1(from_num, content, date1,
time1) VALUES
(?, ?, ?, ?);

The following is code to create database.

private static class DatabaseHelper extends SQLiteOpenHelper
    {
        DatabaseHelper(Context context)
        {
            super(context, DATABASE_NAME, null, DATABASE_VERSION);
            Log.e("In Constructor of DBH", "In Constructor of DBH");
        }

        @Override
        public void onCreate(SQLiteDatabase db)
        {
                try
                {
                        Log.e("in oncreate", "in oncreate");
                        Log.e("In Constructor of DBH", "In Constructor of DBH");
                        db.execSQL(DATABASE_INBOX_CREATE);
                        Log.e("Successfully","Database created successfully");

                }
                catch(Exception e)
                {
                        Log.e("Problem in creation of database",e.toString());
                }
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion)
        {
            Log.w(TAG, "Upgrading database from version " +
oldVersion
                    + " to "
                    + newVersion + ", which will destroy all old
data");

            db.execSQL("DROP TABLE IF EXISTS titles");
            onCreate(db);

        }
    }


But it did not call onCreate(SQLiteDatabase db) never so can some one
tell me what can be the issue in it ?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to