首先创建一个类DataBaseHelper 继承SQLiteOpenHelper
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DataBaseHelper extends SQLiteOpenHelper {
private static final String name = "appledata"; // 数据库名称
private static final int version = 1; // 数据库版本
public static final String PERSONID = "personid";
public static final String AGE = "age";
public static final String NAME = "name";
public DataBaseHelper(Context context) {
super(context, name, null, version);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
//创建一个表格person autoincrement是personid列自动递增<