我正在尝试更新 Windows Phone 8 应用程序上的 Azure 移动服务中的列。该表存储用户数据,我想找到具有特定电子邮件和密码的用户,然后更新其中的一列。目前我有:
IMobileServiceTable<Item> table = App.MobileService.GetTable<Item>();
var account = table
.Where(Item => Item.Email == _email_ && Item.Password == _pass_).
Take(1).ToListAsync();
List<Item> list = account;
list[0].Pursue = pursue; // the value I want to assign
我要更新的专栏名称是“追求”。这个阶段之后我应该做什么?
table.UpdateAsync(account);
我尝试了上面的行,但收到错误(而且更改也应用于“列表”)。有什么建议么?谢谢。
最佳答案
我终于明白了。我在定义类时添加了async关键字(需要使用await)。
IMobileServiceTable<Item> table = App.MobileService.GetTable<Item>();
var account = table
.Where(Item => Item.Email == _email_ && Item.Password == _pass_).
Take(1).ToListAsync();
List<Item> list = await account;
list[0].Pursue = pursue;
await table.UpdateAsync(list[0]);
关于c# - 更新 Windows Azure 移动服务表条目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18403182/