-
database.execSQL("create table if not exists emperors("
-
+ " id integer primary key autoincrement," + " name text,"
-
+ "dynasty text," + "start_year text" + ");");
-
-
SQLiteStatement statement = database
-
.compileStatement("insert into emperors(name,dynasty,start_year) values(?,?,?)");
-
int index = 1;
-
statement.bindString(index++, "朱元璋");
-
statement.bindString(index++, "明");
-
statement.bindString(index++, "1398");
-
statement.execute();
-
-
index = 1;
-
statement.bindString(index++, "玄烨");
-
statement.bindString(index++, "清");
-
statement.bindString(index++, "1722");
-
statement.execute();
-
- statement.close();
-
-
转自:http://www.apkbus.com/android-16352-1-1.html
SQLiteStatement 的用法
最新推荐文章于 2024-12-12 11:08:49 发布
本文介绍了如何使用SQLite数据库创建表并插入皇帝数据,包括朱元璋和玄烨的相关信息。
1519

被折叠的 条评论
为什么被折叠?



