【问题标题】:How to view a data in table如何查看表格中的数据
【发布时间】:2011-06-21 18:56:15
【问题描述】:

我在数据库中插入了EditText 值,请帮助我如何获取table 中的所有数据并在下一个Activity 中显示,请帮助我。我使用以下代码进行插入:

private static final String DATABASE_CREATE = "create table pill (id integer primary key autoincrement, "
    + "med VARCHAR, " + "dose1 VARCHAR,"+"dose2 VARCHAR,"+"dose3 VARCHAR);";

// ---insert data into the database---
public long insertData(String med, String dose1,String dose2,String dose3) {
    ContentValues initialValues = new ContentValues();

    initialValues.put(Med, med);
    initialValues.put(Dose1, dose1);
    initialValues.put(Dose2, dose2);
    initialValues.put(Dose3, dose3);


    return db.insert(DATABASE_TABLE, null, initialValues);
}

meddose1dose2dose3 是来自另一个类中的EditText 的值。

【问题讨论】:

    标签: android sqlite select insert


    【解决方案1】:

    你必须使用:

    db.query()
    

    看到了

    Query only the first data from a table

    【讨论】:

      猜你喜欢
      • 2015-11-06
      • 1970-01-01
      • 1970-01-01
      • 2014-11-26
      • 2017-02-22
      • 2016-12-09
      • 1970-01-01
      • 2010-10-10
      • 1970-01-01
      相关资源
      最近更新 更多