0
点赞
收藏
分享

微信扫一扫

SQLiteDatabase中query、insert、update、delete方法参数说明

眼君 2022-08-02 阅读 96


1、SQLiteDataBase对象的query()接口

public Cursor query (String table, String[] columns, String selection, String[] selectionArgs,String groupBy, String having,String orderBy,String limit)

示例:


ContentValues cv = new ContentValues();
String[] args = {String.valueOf("a")};
query("user",new String[] { "username","password" },"username=?", args,null,null,null, null);


2、SQLiteDataBase对象的insert()接口:

publiclong insert (String table, String nullColumnHack, ContentValues values)

示例:


ContentValues cv = new ContentValues();
cv.put("username", "lanxiaofang");
cv.put("password", "123456");
insert("user", null,cv);


3、SQLiteDataBase对象的update()接口:

publicint update (String table, ContentValues values, String whereClause, String[] whereArgs)

示例:


ContentValues cv = new ContentValues();
cv.put("username", "lanxiao");
cv.put("password", "123456");
String[] args = {String.valueOf("lanxiaofang")};
update("user",cv, "username=?",args)


4、SQLiteDataBase对象的delete()接口:

publicint delete (String table, String whereClause, String[] whereArgs)

示例:


ContentValues cv = new ContentValues();
String[] args = {String.valueOf("lanxiaofang")};
delete("user", "username=?",args);


下面是个人的微信公众号,期待您的关注!!!

SQLiteDatabase中query、insert、update、delete方法参数说明_sqlite




举报

相关推荐

0 条评论