【发布时间】:2015-11-16 10:55:37
【问题描述】:
这是我的代码。
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
String create="create table "+TABLE_NAME+"("+FIELD1+" integer primary key autoincrement, "+FIELD2+" Text, "+FIELD3+" Text )";
String createone="create table "+TABLE_USERS+"("+KEY_FNAME+" Text, "+KEY_LNAME+" Text)";
db.execSQL(create);
db.execSQL(createone);
public void add(String fnm,String lnm)
{
SQLiteDatabase dbone=this.getWritableDatabase();
ContentValues cvone=new ContentValues();
cvone.put(KEY_FNAME, fnm);
cvone.put(KEY_LNAME, lnm);
dbone.insert(TABLE_USERS, null,cvone);
}
【问题讨论】:
-
添加第二条
CREATE TABLE语句。然后增加DATABASE_VERSION的值。 -
当你想添加新表时..??
-
请将代码发送到 add.with Oncreate method.i 也可以,但没有成功
标签: android