View_ID
和MAC_QR_Code
在多行中很常见,但Button_ID
不同。在检索View_ID
时我想要的是它应该被视为单v1
个,并且在图片点击事件中查看所有三个Button_ID
。
插入查询
public void insertData(String view_id, String button_id, String publish_topic, String subscribe_topic, byte[] image, String qr_code){
SQLiteDatabase database = getWritableDatabase();
String sql = "INSERT INTO CONFIG VALUES (NULL, ?, ?, ?, ?, ?, ?)";
SQLiteStatement statement = database.compileStatement(sql);
statement.clearBindings();
statement.bindString(1, view_id);
statement.bindString(2, button_id);
statement.bindString(3, publish_topic);
statement.bindString(4, subscribe_topic);
statement.bindBlob(5, image);
statement.bindString(6, qr_code);
statement.executeInsert();
}
从SQLite获取所有数据
// get all data from SQLite
Cursor cursor =sqLiteHelper.getData("SELECT * FROM CONFIG");
GetAdapter1.clear();
while (cursor.moveToNext()) {
int id = cursor.getInt(0);
String view_id = cursor.getString(1);
String button_id = cursor.getString(2);
byte[] image = cursor.getBlob(5);
GetAdapter1.add(new GetAdapter(view_id, button_id, image, id));
}
答案 0 :(得分:0)
我正在研究它很长时间我在SQLite中看到我们必须使用select命令