我在android中仍然有这个错误! 我读了很多解决方案,但他们没有帮助.. 错误是:没有这样的列:Star :,编译时:select count(*)AS来自tblf的总数,其中recId> 1和name = Star
有什么不对?我该如何解决?
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 :(得分: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] + "'" ;
答案 1 :(得分:0)
当您从设备或模拟器清除数据时,将应用您对数据库的更改。所以: