Silverlight 2 (beta1)数据操作(2)——使用ASP.NET Web Service进行数据CRUD操作(下)
2008-10-11 11:42:49 来源:WEB开发网后台代码void updateButton_Click(object sender, RoutedEventArgs e)
删除数据部分前台界面
{
if (userID.Text.Trim() == string.Empty)
{
errMessage.Foreground = new SolidColorBrush(Colors.Red);
errMessage.Text = "请输入用户ID!";
errMessage.Visibility = Visibility.Visible;
return;
}
if (userName.Text.Trim() == string.Empty)
{
errMessage.Foreground = new SolidColorBrush(Colors.Red);
errMessage.Text = "请输入用户名称!";
errMessage.Visibility = Visibility.Visible;
return;
}
WebServiceProxy.UserManageSoapClient userMgrSoapClient =
new YJingLee.WebSrv.WebServiceProxy.UserManageSoapClient();
//调用更新用户方法
userMgrSoapClient.UpdateUserAsync
(Int16.Parse(userID.Text.Trim()), userName.Text.Trim());
userMgrSoapClient.UpdateUserCompleted +=
new EventHandler<YJingLee.WebSrv.WebServiceProxy.
UpdateUserCompletedEventArgs>
(userMgrSoapClient_UpdateUserCompleted);
}
void userMgrSoapClient_UpdateUserCompleted(object sender,
YJingLee.WebSrv.WebServiceProxy.UpdateUserCompletedEventArgs e)
{
if (e.Error == null)
{
errMessage.Text = "修改用户成功!";
errMessage.Foreground = new SolidColorBrush(Colors.Blue);
errMessage.Visibility = Visibility.Visible;
}
else
{
errMessage.Foreground = new SolidColorBrush(Colors.Red);
errMessage.Text = e.Error.ToString();
errMessage.Visibility = Visibility.Visible;
}
}
Tags:Silverlight 数据
编辑录入:爽爽 [复制链接] [打 印]更多精彩
赞助商链接