首页 文章

关于SQLite中的函数db.execSQL()?

提问于
浏览
1

我是初学者 . 我学习 SQLite . 我不懂功能 db.execSQL (DATABASE_CREATE) ;

private static final String DATABASE_CREATE = "create table users (_id integer primary key autoincrement, "  + "name text not null);";

功能 db.execSQL() . 怎么说的?请帮我 . 谢谢,

1 回答

  • 8

    来自Android SDK documentation for SQLiteDatabase

    execSQL(String sql): Execute a single SQL statement that is NOT a SELECT or any other SQL statement that returns data.

    在您的示例中,要创建表,您将调用 db.execSQL(DATABASE_CREATE) ,它将在您的应用程序的SQLite数据库上执行表create语句 .

相关问题