2016-05-15 65 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)进行查询。

希望它有帮助。任何问题,请随时让我知道。