Parse platform 如何使用Xamarin更新Parse.com数据库中的对象?

Parse platform 如何使用Xamarin更新Parse.com数据库中的对象?,parse-platform,xamarin,Parse Platform,Xamarin,我有一个在线Parse.com数据库,我可以创建对象并查询它们,但不能更新。在Parse.com文档的Xamarin部分中,它只告诉您如何在创建对象后直接更新它,我不想这样做。我尝试将文档中的内容应用于其他平台,但没有成功,我还尝试查询数据库并直接输入新字段值,但它将它们视为单独的函数。有人帮忙吗 Parse.com文档: // Create the object. var gameScore = new ParseObject("GameScore") { { "score",

我有一个在线Parse.com数据库,我可以创建对象并查询它们,但不能更新。在Parse.com文档的Xamarin部分中,它只告诉您如何在创建对象后直接更新它,我不想这样做。我尝试将文档中的内容应用于其他平台,但没有成功,我还尝试查询数据库并直接输入新字段值,但它将它们视为单独的函数。有人帮忙吗

Parse.com文档:

    // Create the object.
var gameScore = new ParseObject("GameScore")
{
    { "score", 1337 },
    { "playerName", "Sean Plott" },
    { "cheatMode", false },
    { "skills", new List<string> { "pwnage", "flying" } },
};
await gameScore.SaveAsync();

// Now let's update it with some new data.  In this case, only cheatMode
// and score will get sent to the cloud.  playerName hasn't changed.
gameScore["cheatMode"] = true;
gameScore["score"] = 1338;
await gameScore.SaveAsync();
//创建对象。
var gameScore=新解析对象(“gameScore”)
{
{“分数”,1337},
{“playerName”,“肖恩·普洛特”},
{“作弊模式”,false},
{“技能”,新列表{“管理”,“飞行”},
};
等待gameScore.SaveAsync();
//现在让我们用一些新数据来更新它。在这种情况下,只有作弊模式
//分数将被发送到云端。playerName没有改变。
gameScore[“作弊模式”]=真;
游戏分数[“分数”]=1338;
等待gameScore.SaveAsync();
我最近尝试的是:

ParseQuery<ParseObject> query = ParseObject.GetQuery("cust_tbl");
IEnumerable<ParseObject> customers = await query.FindAsync();
customers["user"] = admin;
record["score"] = 1338;
await record;
ParseQuery query=ParseObject.GetQuery(“cust_tbl”);
IEnumerable customers=wait query.FindAsync();
客户[“用户”]=管理员;
记录[“得分”]=1338;
等待记录;

在您的示例中,您得到的是对象列表(IEnumerable),而不是单个对象。相反,请尝试以下方法:

ParseQuery<ParseObject> query = ParseObject.GetQuery("cust_tbl");
// you need to keep track of the ObjectID assigned when you first saved,
// otherwise you will have to query by some unique field like email or username
ParseObject customer = await query.GetAsync(objectId);

customer["user"] = admin;
customer["score"] = 1338;
await customer.SaveAsync();
ParseQuery query=ParseObject.GetQuery(“cust_tbl”);
//您需要跟踪首次保存时指定的ObjectID,
//否则,您将不得不通过一些独特的字段(如电子邮件或用户名)进行查询
ParseObject customer=wait query.GetAsync(objectId);
客户[“用户”]=管理员;
客户[“得分”]=1338;
等待customer.SaveAsync();

在您的示例中,您得到的是对象列表(IEnumerable),而不是单个对象。相反,请尝试以下方法:

ParseQuery<ParseObject> query = ParseObject.GetQuery("cust_tbl");
// you need to keep track of the ObjectID assigned when you first saved,
// otherwise you will have to query by some unique field like email or username
ParseObject customer = await query.GetAsync(objectId);

customer["user"] = admin;
customer["score"] = 1338;
await customer.SaveAsync();
ParseQuery query=ParseObject.GetQuery(“cust_tbl”);
//您需要跟踪首次保存时指定的ObjectID,
//否则,您将不得不通过一些独特的字段(如电子邮件或用户名)进行查询
ParseObject customer=wait query.GetAsync(objectId);
客户[“用户”]=管理员;
客户[“得分”]=1338;
等待customer.SaveAsync();

请发布代码,显示您的尝试。请发布代码,显示您的尝试。非常感谢!我犯了个愚蠢的错误,真是帮了大忙。说真的,谢谢你!非常感谢你!我犯了个愚蠢的错误,真是帮了大忙。说真的,谢谢你!