实例如下: /** * 查找一条数据 * @param uid */ public User find(Integer uid){ SQLiteDatabase db=dbOpenHelper.getReadableDatabase(); //创建数据库辅助类 Cursor cursor =db.rawQuery("select * from user where uid=?", new String[]{uid.toString()}); //创建一个游标 if(cursor.moveToFirst()){ //循环遍历查找数组 int uid2=cursor.getInt(cursor.getColumnIndex("uid")); String uname=cursor.getString(cursor.getColumnIndex("uname")); String uaddress=cursor.getString(cursor.getColumnIndex("uaddress")); User user=new User(); user.setUid(uid2); user.setUname(uname); user.setUaddress(uaddress); return user; } cursor.close(); return null; }