Web服务不显示我的方法

时间:2013-06-11 06:45:33

标签: wcf web-services web-reference

我已经制作了一个网络服务,它会向我提供用户信息。

[WebMethod]
public void Get_User_Info(string uid)
{
    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["contest"].ConnectionString);
    SqlCommand com = new SqlCommand("select * from mtblUser where UserId=@UserId", con);
    com.CommandType = CommandType.Text;
    com.Parameters.Add("@UserId", SqlDbType.NVarChar, 50).Value = uid;
    SqlDataAdapter sda = new SqlDataAdapter(com);
    DataTable dt = new DataTable();
    sda.Fill(dt);

}

此Web服务有一个方法Get_User_Info()。但是当我尝试使用这种方法时,名字窗格会显示4种方法,如下面的

Get_User_InfoRequest

Get_User_InfoRequestBody

Get_User_InfoResponse

Get_User_InfoResponseBody

如何使用我的方法请帮助。

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试

YourService.ServiceSoapClient _CurrentSrv = new YourService.ServiceSoapClient();
_CurrentSrv.Get_User_Info(YourId);