silverlight 3 使用ADO.NET SERVICE 定期更新数据
//在做更新数据时遇到麻烦,查看资料,但似乎所有的资料都是结合了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());
}
}