您的位置:首页 > 数据库

SQLite的使用示例

2016-04-28 15:16 477 查看
public class CoolWeatherOpenHelper extends SQLiteOpenHelper {

/**
* Province表建表语句
*/

public static final String CREATE_PROVINCE="create table Province("

+"id integer primary key autoincrement,"

+"city_name text,"

+"province_id integer)";

//构造方法 四个参数: context, name, factory,version

public CoolWeatherOpenHelper(Context context, String name, CursorFactory factory, int version){

super(context,name,factory,version);

@override

public void onCreate(SQLiteDatebase db){

db.execSQL(CREATE_PROVINCE);//创建Province表

}

@Override

public void onUpgrade(SQLiteDatabase db, int oldVersion,int newVersion){

super(context,name,factory,version);}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: