这是Activity里面的代码getIntent().setData(Uri.parse("content://com.huawei.biz.FormProvider/PlAYER/PLAY_NAME"));
        Uri uri=getIntent().getData();
        
        String select_args[]={String.valueOf(money),String.valueOf(exp)};
        getContentResolver().update(uri,null, User, select_args);这是ContentProvider里面的代码@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
    SQLiteDatabase db=OpenHelper.getReadableDatabase();
        String sql="update " +selection+ " from PLAYER where PLAY_MONEY =? and PLAY_EXP=?";
        db.rawQuery(sql, selectionArgs);
        
        Log.d(TAG,"update");
return 0;
}这是报的错误:01-05 21:31:58.562: ERROR/AndroidRuntime(1074): Caused by: android.database.sqlite.SQLiteException: near "from": syntax error: , while compiling: update Wc from PLAYER where PLAY_MONEY =? and PLAY_EXP=?

解决方案 »

  1.   

    UPDATE 表名称 SET 列名称 = 新值 WHERE 列名称 = 某值
      

  2.   

    activity 的中传入的 select_args 参数,没有在你contentprovider的update 函数里面调用。你的sql语句是:String sql="update " +selection+ " from PLAYER where PLAY_MONEY =? and PLAY_EXP=?"PLAY_MONEY =? and PLAY_EXP=? 中两个问号处应该用select_args中传入的值代替 即PLAY_MONEY = select_args[0]  PLAY_EXP=select_args[1]
      

  3.   

    sql语句错误!说的很清楚,在from的旁边!PLAY_MONEY =? and PLAY_EXP=?等于的值呢?
      

  4.   

     String sql="update " +selection+ " from PLAYER where PLAY_MONEY =? and PLAY_EXP=?";这sql语句能不出错吗?楼主再去看看sql 增删改语句吧!
      

  5.   

    String sql="update " +selection+ " from PLAYER where PLAY_MONEY =? and PLAY_EXP=?";
    SQL语句错误啊,大哥
      

  6.   

    我2了不解释果断再去看看sql语句