嗨我想从sqlite数据库中获取数据。我想使用一种方法在我的Edittext中加载数据。
private void ladeDaten(String tbname,String fach)
{
String select = "SELECT info FROM "+tbname+" WHERE name='"+fach+"'";
String info = ""; // how I can
((EditText)(findViewById(R.id.txtContacto))).setText(info);
}
我该怎么办?
答案 0 :(得分:0)
为您解决方案:
public int GetDeptID(String Dept)
{
SQLiteDatabase db=this.getReadableDatabase();
Cursor c=db.rawQuery("SELECT "+colDeptID+" as _id FROM "+deptTable+" WHERE "+colDeptName+"=?",
new String []{Dept});
c.moveToFirst();
return c.getInt(c.getColumnIndex("_id"));
}
在此处阅读更多内容:http://mobileorchard.com/android-app-development-using-sqlite-database/
仅限ITS示例