Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread Kumar Bibek
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie
06-05 16:14:05.703: 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
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.os.Handler.dispatchMessage(Handler.java:99)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.os.Looper.loop(Looper.java:123)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.app.ActivityThread.main(ActivityThread.java:3683)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
java.lang.reflect.Method.invokeNative(Native Method)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
java.lang.reflect.Method.invoke(Method.java:507)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
dalvik.system.NativeStart.main(Native Method)
06-05 16:14:05.703: E/AndroidRuntime(353): Caused by: 
android.database.sqlite.SQLiteException: no such table: record: , while 
compiling: SELECT name FROM record
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteCompiledSql.init(SQLiteCompiledSql.java:65)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteProgram.init(SQLiteProgram.java:83)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteQuery.init(SQLiteQuery.java:49)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1235)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1189)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1271)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
com.NursingcareSystem.Care_ALL_intent.onCreate(Care_ALL_intent.java:82)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-05 16:14:05.703: E/AndroidRuntime(353): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
... 11 more





-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie
i think the problem is my table can't be build that make my query  compiling
 stop 

-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread Kumar Bibek
Try changing strings to text...

*Thanks and Regards,
Kumar Bibek*
*
http://techdroid.kbeanie.com
http://www.kbeanie.com*



On Tue, Jun 5, 2012 at 10:27 PM, shengJie b0091...@gmail.com wrote:

 i think the problem is my table can't be build that make my query
 compiling stop

 --
 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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread Kumar Bibek
Uninstall your app. Run it again, and get the logs. 

On Tuesday, 5 June 2012 22:27:16 UTC+5:30, shengJie wrote:

 i think the problem is my table can't be build that make my query  
 compiling stop 

-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie


tks for trying to fixed my problem


-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie


 i uninstall my app an i clean up my project



===log
06-05 17:09:29.311: D/dalvikvm(2147): GC_EXTERNAL_ALLOC freed 43K, 53% free 
2546K/5379K, external 1815K/2137K, paused 75ms
06-05 17:11:58.091: W/KeyCharacterMap(2147): No keyboard for id 0
06-05 17:11:58.091: W/KeyCharacterMap(2147): Using default keymap: 
/system/usr/keychars/qwerty.kcm.bin
06-05 17:12:07.561: I/haiyang:createDB(2147): create table record(_id 
INTEGER PRIMARY KEY AUTOINCREMENT,care_IDtext not null,nametext not 
null,sextext not null,person_idtext not null,blood_typetext not 
null,smoketext,drunktext,Diagnosis_typetext,Diagnosis_bodytext,care_Diagnosistext,whatcaretext,whencareinteger,whocaretext,carewhotext,care_locatationtext,care_frequencytext,singaltimetext,care_Appraisaltext);
06-05 17:12:07.582: I/Database(2147): sqlite returned: error code = 1, msg 
= no such column: name
06-05 17:12:07.582: D/AndroidRuntime(2147): Shutting down VM
06-05 17:12:07.591: W/dalvikvm(2147): threadid=1: thread exiting with 
uncaught exception (group=0x40015560)
06-05 17:12:07.621: E/AndroidRuntime(2147): FATAL EXCEPTION: main
06-05 17:12:07.621: E/AndroidRuntime(2147): java.lang.RuntimeException: 
Unable to start activity 
ComponentInfo{com.NursingcareSystem/com.NursingcareSystem.Care_ALL_intent}: 
android.database.sqlite.SQLiteException: no such column: name: , while 
compiling: SELECT name FROM record
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.os.Handler.dispatchMessage(Handler.java:99)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.os.Looper.loop(Looper.java:123)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.app.ActivityThread.main(ActivityThread.java:3683)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
java.lang.reflect.Method.invokeNative(Native Method)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
java.lang.reflect.Method.invoke(Method.java:507)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
dalvik.system.NativeStart.main(Native Method)
06-05 17:12:07.621: E/AndroidRuntime(2147): Caused by: 
android.database.sqlite.SQLiteException: no such column: name: , while 
compiling: SELECT name FROM record
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:92)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteCompiledSql.init(SQLiteCompiledSql.java:65)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteProgram.init(SQLiteProgram.java:83)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteQuery.init(SQLiteQuery.java:49)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1356)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1235)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1189)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1271)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
com.NursingcareSystem.Care_ALL_intent.onCreate(Care_ALL_intent.java:82)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-05 17:12:07.621: E/AndroidRuntime(2147): at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-05 17:12:07.621: E/AndroidRuntime(2147): ... 11 more
 

-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread Kumar Bibek
care_IDtext not null,nametext not null,sextext not null,person_idtext not 
null,blood_typetext not null,smoketext,drunktext,
Diagnosis_typetext,Diagnosis_bodytext,care_Diagnosistext,
whatcaretext,whencareinteger,whocaretext,carewhotext,care_
locatationtext,care_frequencyte

Your create table query is not correct. There should be a space between 
name and text etc.

-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie
this is my query 
i want to load all user_name and
put into a spinner
--
Cursor c = db.query(UserSchema.TABLE_NAME, new String[]{UserSchema.NAME}, 
null, null, null, null, null);
c.moveToFirst();
CharSequence[] newlist = new CharSequence[c.getCount()];
for(int i = 0;inewlist.length;i++){
newlist[i] = c.getString(0);
c.moveToNext();
}
c.close();

-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread Kumar Bibek
Your logs suggest that the table itself is not there. So first try to
figure out why the table is not being created.

*Thanks and Regards,
Kumar Bibek*
*
http://techdroid.kbeanie.com
http://www.kbeanie.com*



On Tue, Jun 5, 2012 at 11:03 PM, shengJie b0091...@gmail.com wrote:

 this is my query
 i want to load all user_name and
 put into a spinner
 --
 Cursor c = db.query(UserSchema.TABLE_NAME, new String[]{UserSchema.NAME},
 null, null, null, null, null);
 c.moveToFirst();
 CharSequence[] newlist = new CharSequence[c.getCount()];
 for(int i = 0;inewlist.length;i++){
 newlist[i] = c.getString(0);
 c.moveToNext();
 }
 c.close();

 --
 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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread rambabu mareedu
 here the problem is your table not creating..first of all take 2 or 3
columns and run it ..after that extend the columns

-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie


 i pull out my database file and check it schema

== 

 SQLite version 3.7.12.1 2012-05-22 02:45:53
 Enter .help for instructions
 Enter SQL statements terminated with a ;
 sqlite .schema
 CREATE TABLE android_metadata (locale TEXT);
 CREATE TABLE record(_id INTEGER PRIMARY KEY AUTOINCREMENT,care_IDtext not 
 null,n
 ametext not null,sextext not null,person_idtext not null,blood_typetext 
 not null

 ,smoketext,drunktext,Diagnosis_typetext,Diagnosis_bodytext,care_Diagnosistext,wh

 atcaretext,whencareinteger,whocaretext,carewhotext,care_locatationtext,care_freq
 uencytext,singaltimetext,care_Appraisaltext);
 sqlite

==
why show android metadata(locale TEXT) 

-- 
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie


shengJie於 2012年6月6日星期三UTC+8上午1時53分25秒寫道:

 then i got two table android_metadata and record
 
 sqlite .tables
 android_metadata  record
 sqlite 


problem solved!!!
tks for all 

i try go get  rid of android_metadata 
and i pass it !!!


@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
db.execSQL(DROP TABLE IF EXISTS record);
db.execSQL(DROP TABLE IF EXISTS android_metadata);
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

Re: [android-developers] I/Database(353): sqlite returned: error code = 1, msg = no such table: record

2012-06-05 Thread shengJie
tks for all help me to solve this problem!

-- 
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