0

如何创建一个只有一行来存储用户名和密码值的 sqlite 数据库。任何时候尝试添加其他数据,应用程序都不允许。

   public void onCreate(SQLiteDatabase db) {
    // TODO Auto-generated method stub      

    String sqlDataStore = "create table if not exists " +
    DATABASE_NAME + " ("+ BaseColumns._ID + " integer primary key autoincrement,"

                + COLUMN_USER + " text not null,"
                + COLUMN_CODE + " text not null);";

    db.execSQL(sqlDataStore);
}
4

1 回答 1

0
String sqlDataStore = "create table if not exists " +
TABLE_NAME + " ("+ BaseColumns._ID + " integer primary key autoincrement,"

            + COLUMN_USER + " text not null,"
            + COLUMN_CODE + " text not null);";

TABLE_NAME不是DATABASE_NAME。_

如果您想要更好的答案,请提交您编写的代码以添加新数据。

于 2012-09-26T14:45:03.793 回答