在sql-light中选择查询在android中不适用于我

时间:2012-11-26 18:55:57

标签: android

这段代码对我有用:

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。

1 个答案:

答案 0 :(得分:1)

我认为您使用的是不正确的连接运算符。请参阅下面的问题。

How to concatenate strings with padding in sqlite