×

Loading...
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务
Ad by
  • 推荐 OXIO 加拿大高速网络,最低月费仅$40. 使用推荐码 RCR37MB 可获得一个月的免费服务

.Net web service question: // thanks!

I have a User object, UserID (int) and UserName (string)

Now I have 2 web method called
GetUser(int userID);
UpdateUser (User user);

then I invoke those 2 methods in my client application, I found I can pass correct int userID through the GetUser(), but couldn't pass correct user.UserID in UpdateUser(), the userName is always correct, for example:
User myUser = new User();
myUser.UserID=200;
myUser.UserName = "abc";
proxy.UpdateUser(myUser);

in UpdateUser()
the UserID= 0
UserName = "abc";

Anybody can give me a hint?

thanks!
Report

Replies, comments and Discussions:

  • 工作学习 / 专业技术讨论 / .Net web service question: // thanks!
    I have a User object, UserID (int) and UserName (string)

    Now I have 2 web method called
    GetUser(int userID);
    UpdateUser (User user);

    then I invoke those 2 methods in my client application, I found I can pass correct int userID through the GetUser(), but couldn't pass correct user.UserID in UpdateUser(), the userName is always correct, for example:
    User myUser = new User();
    myUser.UserID=200;
    myUser.UserName = "abc";
    proxy.UpdateUser(myUser);

    in UpdateUser()
    the UserID= 0
    UserName = "abc";

    Anybody can give me a hint?

    thanks!
    • 你的那个class的定义是不是有问题啊
      • public abstract partial class,我也觉得可能是这个问题。
        • up....
    • Check your setUserID() method in your User.
      • nothing about this.
    • Is that a remote call? Serilization issue...
      • kind of. :)
    • When I had those kind of issue, I just bypass them by using "updateUser(UserId,UserName)", no wonder I did so poor in job interview :-(