2011-05-29 102 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 + "'",