×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

.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 :-(