这是我的class databasehelper extends SQLiteOpenHelper
public List<Product>getListIndo(){
Product product = null;
List<Product>productList = new ArrayList<>();`enter code here`
openDatabase();
Cursor cursor = mDatabase.rawQuery("select * from product, null);
cursor.moveToFirst();
while (!cursor.isAfterLast()){
product = new Product(cursor.getInt(0),cursor.getString(1),cursor.getString(2),cursor.getString(3),cursor.getString(4),cursor.getString(5));
productList.add(product);
cursor.moveToNext();
}
cursor.close();
closeDatabase();
return productList;
}
答案 0 :(得分:0)
您想将哪个值传递给databasehelper?您在sql查询中使用select
方法,这意味着从表product
中检索不插入的数据。如果您在数据库中插入内容,则必须使用INSERT INTO table_name