
Private Context mContext;
Public static final String="CREATE TABLE SQL gnu (+"
"_id INTEGER PRIMARY KEY AUTOINCREMENT, +"
"BSSID TEXT," +
The name "TEXT," +
"Liable_person TEXT, +"
"The date TEXT," +
"The state INTEGER)";
Public static final String black="CREATE TABLE gunblack (+"
"_id INTEGER PRIMARY KEY AUTOINCREMENT, +"
"BSSID TEXT)";
//create the library
Public MyHelper Context (Context) {
Super (context, "Gun_magazine. Db", null, 2);
MContext=context;
}
@ Override
Public void onCreate (SQLiteDatabase db) {
Db. ExecSQL (SQL);//create a table
Db. ExecSQL (black);
Toast. MakeText (mContext, "database creation success", Toast. LENGTH_SHORT), show ();
}
@ Override
Public void onUpgrade (SQLiteDatabase db, int oldVersion, int newVersion) {
}
}
Use:
public List
SQLiteDatabase db=helper. GetReadableDatabase ();
C=the db of the Cursor. The query (" gunblack ", null, null, null, null, null, "_id DESC");//this line error
List
While (c. oveToNext ()) {
Be sad etColumnIndex chtistina georgina rossetti.british poetess long be sad etLong chtistina georgina rossetti.british poetess id=((" _id "));
Be sad etString chtistina georgina rossetti.british poetess String BSSID=(1);
List. The add (BSSID);
}
Arthur c. lose ();
db.close();
return list;
}
CodePudding user response:
Like the previous database delete can run, a predecessor for the troubleCodePudding user response:
Gunblack table do not create successCodePudding user response:
Database don't delete, next time just create a table or other operations, can be the database version + 1, then add to build table field operations such as in the onUpgrade method