String sql = "UPDATE diary Set weather="+"\""+strWeather+"\""+" where(create_year=" + "\"" + strYear+ "\"" + " and create_month=" + "\"" + strMonth + "\""+ " and create_day=" + "\"" + strDay + "\"" + ")";
db.execSQL(sql);
调试时,出现错误,一直没有弄懂为什么,大家帮忙看看呢。03-25 13:50:03.713: E/Database(8567): Failure 21 (out of memory) on 0x0 when preparing 'delete from diary where(create_year="2012" and create_month="03" and create_day="25")'.

解决方案 »

  1.   

    帖子上面的错误不对,错误是下面的情况:
    03-25 14:31:23.023: E/AndroidRuntime(10090): android.database.sqlite.SQLiteException: unknown error: UPDATE diary Set weather="晴" where(create_year="2012" and create_month="03" and create_day="25")
      

  2.   

    我将查询sql语句放在adb上直接运行,按下键盘回车后,控制台就挂住不往下执行了,目前都还没用找到问题的原因,我只好换另外的方式进行处理了!
      

  3.   

    语句写错了。多加了双引号。
    String sql = "UPDATE diary Set weather="+"\""+strWeather+"\""+" where(create_year=" 
    String sql = "UPDATE diary Set weather="+strWeather+" where(create_year=" 
      

  4.   

    是要加引号,不然SQL执行会报错。
    不加引号情况是以下情况:
    update  diary Set weather=晴 where...
    加引号情况为:
    update  diary Set weather="晴" where...
    第二种才是对的吧。
      

  5.   

    SQL语句是单引号好不好,改成 ' 就对了 
     UPDATE diary Set weather='晴' where(create_year='2012' and create_month='03' and create_day='25')