更新的Windows Azure移动服务表条目 [英] Updating Windows Azure Mobile Service Table Entries

查看:125
本文介绍了更新的Windows Azure移动服务表条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试更新的Windows Phone 8应用在Azure中移动服务的列。该表存储用户数据,我想找到具有特定的电子邮件和密码的用户,然后更新它的列。目前,我有:

I am trying to update a column in Azure Mobile Services on Windows Phone 8 app. The table stores user data and I want to find the user having a specific email and password and then update a column of it. Currently I have:

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

我想更新的追求的列的名称。我应该怎么这个阶段之后做什么?

Name of the column I want to update is 'Pursue'. What should I do after this phase?

table.UpdateAsync(account);

我试过上面的线,但我得到一个错误(同样的变化应用到列表)。有什么建议么?谢谢你。

I tried the line above but I get an error (Also the change is applied to 'list'). Any suggestions? Thanks.

推荐答案

我终于想通了。定义类(使用等待必需的),当我加入异步关键字。

I finally figured it out. I added async keyword when defining the class (required to use 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]);

这篇关于更新的Windows Azure移动服务表条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆