2016-05-15 29 views
0

我從Azure表中獲取所有項目,但它沒有給出該行的ID 這裏是我獲取所有項目的方法。Azure沒有得到該行的ID

new AsyncTask<Void, Void, Void>() { 
     @Override 
     protected Void doInBackground(Void... params) { 
      try { 
       final List<Hyip> results = mTable.execute().get(); 
       activity.runOnUiThread(new Runnable() { 
        @Override 
        public void run() { 
         eAdapter.clear(); 
         try { 
          for (Hyip item : results) { 
            eAdapter.add(item); 
          } 
         } catch (Exception e) { 
          e.printStackTrace(); 
         } finally { 
          eAdapter.notifyDataSetChanged(); 
          ((MainActivity)context).isDone = true; 
         } 
        } 
       }); 
      } catch (Exception exception) { 
       exception.printStackTrace(); 
       exception.getCause(); 
      } 
      return null; 
     } 
} 

我怎樣才能得到行ID?有人能幫助我嗎?

回答

0

Azure Table存儲是一種在雲中存儲結構化NoSQL數據的服務,實體的分區和行鍵唯一標識表中的實體。

因此,如果您使用Azure表存儲,表中沒有id列。查看here瞭解更多詳情。

1

根據我對您代碼的理解,您似乎使用Android客戶端SDK獲取了來自Mobile Service Table的項目,而不是Azure Table Storage。

所以我建議你可以嘗試參考官方教程How to use the Android client library for Mobile Apps知道如何使用它。

如果您使用Azure表存儲,如@Steven所述,它是NoSQL存儲服務,表中沒有id列缺省值。但是您可以嘗試爲實體定義一個id屬性,並使用自定義唯一標識(例如UUID或GUID)進行查詢。

希望它有幫助。任何問題,請隨時讓我知道。