Trying to insert data in database from edittext in android
but data is not inserting.
MY CODE —
ContentValues values= new ContentValues();
values.put(KEY_EMAIL, GlobalVar.email);
values.put(KEY_NAME, GlobalVar.name);
myDataBase.insert(MY_EMP, null,values);
MY LOG CAT
04-10 09:50:20.121: E/running(280): create database called
04-10 09:50:20.121: E/running(280): chek database called
04-10 09:50:20.121: E/running(280): chek database try block called
04-10 09:50:20.171: E/running(280): create database called try block
04-10 09:50:20.191: E/running(280): copy database called
04-10 09:50:20.211: E/running(280): open data successfull
04-10 09:50:50.720: W/KeyCharacterMap(280): No keyboard for id 0
04-10 09:50:50.720: W/KeyCharacterMap(280): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
`
If you don’t supply all the required column data (i.e. data for all columns that don’t have a default value, accept null, or are auto-incrementing), then the insert command will fail.
However, if
insertfails, it doesn’t throw an exception. It just returns -1.Check the result of your
insertcall, or better yet, change the call toand then check the logs for the exception message assuming there is one.