Android 数据库sqlite一次创建多个表?

muyouyisheng muyouyisheng 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我想在数据库中一次性建立多个表,可是为什么只能建立第一个,运行到第二个的时候程序就强退呢?
public class DatabaseHelper extends SQLiteOpenHelper{
public DatabaseHelper(Context context, String name, CursorFactory factory,
int version) {
//必须通过super调用父类当中的构造函数
super(context, name, factory, version);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
db.execSQL("create table table1 (name varchar(20),pw varchar(20))");
db.execSQL("create table table2(id int,a long,b long,c long)");
db.execSQL("create table table3(id int,a long,b long,c long)");
db.execSQL("create table table4(id int,a long,b long,c long)");
db.execSQL("create table table5(id int,a long,b long,c long)");
db.execSQL("create table table6(id int,a long,b long,c long)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
}
}
...全文

相关推荐

评论 12
收藏 已收藏
分享
返回顶部
muyouyisheng
Android 80,490 成员 91,375 内容