silverlight 3 使用ADO.NET SERVICE 定期更新数据

keiven8 keiven8 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
//在做更新数据时遇到麻烦,查看资料,但似乎所有的资料都是结合了dataGrid 进行数据更新的。请高手们帮帮忙!感激不尽了!分不多了,大家帮帮忙!
//silverlight 3 使用ADO.NET SERVICE 定期更新数据

void timer_autoSave_Tick(object sender, EventArgs e)
{
if (userState.userId > 0)
{
// 自动保存用户状态到数据库
var query = from userInfo in proxy.userTable
where userInfo.userId == userState.userId
select userInfo;

try
{
MessageBox.Show("开始执行异步处理……");

//在这里我如何更新 userTable 下的 字段如 userScore 的值为 userScore+=100;

}
catch (DataServiceRequestException ex)
{
MessageBox.Show("发生异常1:"+ex.ToString());
}
}
}

void onUpdateCompleted(IAsyncResult result)
{
try
{
proxy.EndSaveChanges(result);
MessageBox.Show("执行成功!"+result.ToString());
}
catch (DataServiceRequestException ex)
{
MessageBox.Show("发生异常2:"+ex.Response.ToString());
}

}
...全文
评论 5
收藏 已收藏
分享
返回顶部
keiven8
WPF/Silverlight 8,757 成员 12,031 内容