You might want to show more of your logs. There's probably some error while creating your database.
*Thanks and Regards, Kumar Bibek* * http://techdroid.kbeanie.com http://www.kbeanie.com* On Tue, Jun 5, 2012 at 10:08 PM, shengJie <b0091...@gmail.com> wrote: > Sorry guy > my database table can't be set > i can build my database but i can't set up my table!!! > did i miss something? > ==========log======== > I/haiyang:createDB(353): create table record(_id INTEGER PRIMARY KEY > AUTOINCREMENT,careID string not null,name string not null,sex string not > null,person_id string not null,blood_type string not null,smoke string,drunk > string,Diagnosis_type string,Diagnosis_body string,care_Diagnosis string, > whatcare string,whencare integer,whocare string,carewho string, > care_locatation string,care_frequency string,singaltime string, > care_Appraisal string); > > I/Database(353): sqlite returned: error code = 1, msg = no such table: > record > D/AndroidRuntime(353): Shutting down VM > W/dalvikvm(353): threadid=1: thread exiting with uncaught exception > (group=0x40015560) > E/AndroidRuntime(353): FATAL EXCEPTION: main > E/AndroidRuntime(353): java.lang.RuntimeException: Unable to start > activity > ComponentInfo{com.NursingcareSystem/com.NursingcareSystem.Care_ALL_intent}: > android.database.sqlite.SQLiteException: no such table: record: , while > compiling: SELECT name FROM record > > > > ------------------------------------------------------------------------------------------------------------------------------------------------ > public static class DBConnection extends SQLiteOpenHelper{ > private static final String DATABASE_NAME="medical_records"; > private static final int DATABASE_VERSION=1; > public DBConnection(Context context) { > super(context, DATABASE_NAME, null, DATABASE_VERSION); > // TODO Auto-generated constructor stub > } > > @Override > public void onCreate(SQLiteDatabase db) { > // TODO Auto-generated method stub > db.beginTransaction(); > try{ > String caredb = > "create table record(_id INTEGER PRIMARY KEY AUTOINCREMENT," > +UserSchema.CARE_ID+ "string not null," > +UserSchema.NAME+ "string not null," > +UserSchema.SEX+ "string not null," > +UserSchema.PERSON_ID+ "string not null," > +UserSchema.BLOOD_TYPE+ "string not null," > +UserSchema.SMOKE+ "string," > +UserSchema.DRUNK+ "string," > +UserSchema.D_TYPE+ "string," > +UserSchema.D_BODY+ "string," > +UserSchema.CARE_D+ "string," > +UserSchema.WHATCARE+ "string," > +UserSchema.WHENCARE+ "integer," > +UserSchema.WHOCARE+ "string," > +UserSchema.CAREWHO+ "string," > +UserSchema.CARE_LOCATION+ "string," > +UserSchema.CARE_F+ "string," > +UserSchema.SINGAL+ "string," > +UserSchema.CARE_APPRAISAL+"string);" ; > Log.i("haiyang:createDB", caredb); > db.execSQL(caredb); > }catch(Exception e){ > db.setTransactionSuccessful();} > finally{ > db.endTransaction(); > } > } > @Override > public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { > // TODO Auto-generated method stub > db.execSQL("DROP TABLE IF EXISTS record"); > onCreate(db); > } > > --------------------------------------------------------------------------------------------------------------------------------------- > > -- > 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 -- 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