带有Windows应用程序的C#Webservice

带有Windows应用程序的C#Webservice,c#,web-services,tsql,C#,Web Services,Tsql,我在C#中创建了一个简单的Web服务,它返回一个包含从SQL存储过程调用的所有值的表。我需要一些帮助,我想在windowsform应用程序中为我的datagridview实现一个搜索文本框。如何将StoredProcess中的@search传递给我的windows应用程序并将值发送回存储过程?另外,如果我用错误的方法处理这个问题,请让我知道,谢谢 SqlConnection connection = new SqlConnection(ConfigurationManager.Conne

我在C#中创建了一个简单的Web服务,它返回一个包含从SQL存储过程调用的所有值的表。我需要一些帮助,我想在windowsform应用程序中为我的datagridview实现一个搜索文本框。如何将StoredProcess中的@search传递给我的windows应用程序并将值发送回存储过程?另外,如果我用错误的方法处理这个问题,请让我知道,谢谢

    SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ORCA"].ToString());

    SqlCommand cmd = new SqlCommand("usp_getcardinfo", connection);
    cmd.CommandType = System.Data.CommandType.StoredProcedure;
到目前为止,这会很好地填充datagridview。希望获取它,以便您可以搜索并在datagridview中显示该记录


谢谢

将web方法更改为参数

[WebMethod] 
public List<clubmembers> GetClubMembers(String search)
SqlParameter paramSearch = new SqlParameter ("@search",SqlDbType.VarChar);
paramSearch.Value = search;
cmd.Parameters.Add(paramSearch);