2011-05-29 58 views
-1

当我尝试在行POINTA(SQLite中的文本数据类型)中搜索,并将其与一个字符串进行比较时,程序停止。这是代码:STRING在SQLite数据库查询

public Cursor getpoints(String start,String end) throws SQLException { 
    Cursor mCursor = db.query(true, DATABASE_TABLE, new String[] { 
       KEY_PRIM, 
       NAME, 
       POINTA, 
       POINTA_LANG, 
       POINTA_LAT, 
       POINTB, 
       POINTB_LANG, 
       POINTB_LAT 
       }, 
       POINTA +"=" +start,//here is the problem 

       null, 
       null, 
       null, 
       null, 
       null); 
if (mCursor != null) { 
    mCursor.moveToFirst(); 
} 
... 
+0

你一定_START_没有空? – mah 2011-05-29 11:44:39

回答

1

同样的问题为this,你需要在你的start字符串单引号,即

 POINTA + "='" + start + "'",