活动android选择查询

时间:2017-03-22 08:30:07

标签: android sqlite activeandroid

new Select("id")
.From(customer)
.where("lastName=?","John")
.execute();
  

错误

 E/CursorWindow: Failed to read row 0, column -1 from a CursorWindow which has 1 rows, 1 columns.
  

主要查询(从客户中选择id,其中lastName =" John&#34 ;;)

1 个答案:

答案 0 :(得分:0)

尝试

List<Customer> results = new Select().from(Customer.class).where("lastName=?","John").execute();

if(results.size() > 0) {
    long id = results.get(0).getId(); 
}