简体   繁体   中英

How to create simple database with only 2 columns and use it in Android? (using SQLiteOpenHelper)

Well, I've got some code below, but I don't really know how it works and how to fill it. I need to fill it with about 30 thousands elements.

public class DatabaseHelper extends SQLiteOpenHelper {
 static final String dbName="demoDB";

 static final String quoteTable="Quote";
 static final String quoteID="ID";
 static final String quoteText="Quote";

 static final String viewEmps="ViewEmps";


 public DatabaseHelper(Context context) {
      super(context, dbName, null,33);
      }




public void onCreate(SQLiteDatabase db) {


    db.execSQL("CREATE TABLE "+quoteTable+" ("+
    quoteID+ " INTEGER PRIMARY KEY , "+
            quoteText+ " TEXT)");

}

Checkout this three useful tutorials:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM