Do you know if the database had previously been created? I'm thinking
it did when you tested the notepad tutorial and therefore the
DATABASE_CREATE never gets executed. Try wiping the data on the
emulator.
On Apr 3, 1:05 pm, Kevin Tan <[EMAIL PROTECTED]> wrote:
> hi,
> I got an error on the emulator saying that the table new was not
> found. From the debugger, I notice that the program never entered the
> catch block, and therefore the table is not created. I borrowed this
> code from the notepad tutorial and it worked fine when i did the
> tutorial. Does anyone know what else I could be missing?
>
> private static final String DATABASE_NAME = "test";
> private static final String DATABASE_TABLE = "new";
>
> public FileShareDbAdapter open() throws SQLException {
> try {
> mDb = mCtx.openDatabase(DATABASE_NAME, null);
> } catch (FileNotFoundException e) { //this was never entered
> even if i change the DATABASE_NAME to anything else
> try {
> mDb =
> mCtx.createDatabase(DATABASE_NAME,
> DATABASE_VERSION, 0,
> null);
> mDb.execSQL(DATABASE_CREATE);
> } catch (FileNotFoundException e1) {
> throw new SQLException("Could not create database");
> }
> }
> return this;
> }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---