这段代码对我有用:
SQL = "SELECT _id,Fname,Lname,Phone,Car,CarNum,PicNum from MEN order by Lname,Fname";
.
.
public void update_list(String NN) {
c = db.rawQuery(NN, null);
startManagingCursor(c);
String[] from = new String[]{"_id","PicNum","Fname","Lname","Car","CarNum" };
int[] to = new int[]{ R.id._id,R.id.MyPic,R.id.Fname ,R.id.Lname,R.id.Car,R.id.CarNum };
SimpleCursorAdapter notes = new SimpleCursorAdapter (this, R.layout.my_list, c, from, to);
setListAdapter(notes);
setListAdapter(new SimpleCursorAdapter(this, R.layout.my_list, c, from,to) {
但如果我的查询是这样的:
SQL = "SELECT _id,Fname + Lname as Fname,Lname,Phone,Car,CarNum,PicNum from MEN order by Lname,Fname";
我在 Fname 列中得到 0。