2014-09-11 103 views
0

我仍然有這個錯誤在Android! 我讀了許多解決方案,但他們是沒有幫助的.. 的錯誤是:沒有這樣的列:星:,編譯時:SELECT COUNT(*)爲總從tblf其中recId> 1名=星沒有這樣的列錯誤

什麼是錯的?我該如何解決它?

private void useRawQuery3() { 
    // TODO Auto-generated method stub 
    String[] args = {"1","Star"} ; 
    String mySQL = " select count(*) AS Total from tblf" 
    + " where recId>" + args[0] + " and name=" + args[1] ; 
    Cursor c1 = db.rawQuery(mySQL, null) ; 
    int index = c1.getColumnIndex("Total") ; 
    c1.moveToFirst() ; 
    int theTotal = c1.getInt(index) ; 
    Toast.makeText(this, " Total3="+theTotal, Toast.LENGTH_LONG).show() ; 
} 
+0

從手機中清除您的應用程序數據。然後重啓你的應用程序 – SerCna 2014-09-11 07:35:33

回答

0

試試這個:

select count(*) AS Total from tblf where recId>1 and name='Star' 

含義:

String mySQL = " select count(*) AS Total from tblf" 
    + " where recId>" + args[0] + " and name='" + args[1] + "'" ; 
+0

但我應該使用這種方式.. 哪裏是我的方式錯了? – 2014-09-11 07:35:20

+0

你的星星 – alpinescrambler 2014-09-11 07:36:05

+0

之前和之後沒有單一的報價..它的工作.. 這些句子寫什麼規則? 的意思是像空格,引號等? – 2014-09-11 07:48:35

0

您對數據庫更改將被應用在從設備或模擬器你清晰的數據。所以:

  1. 從您的設備清除您的應用程序的數據。
  2. 重新啓動您的應用程序。
+0

我每次運行應用程序時都會清除它。 – 2014-09-11 07:50:30