I created a simple webservice in C# that returns a table with all the values which is called from a SQL Stored Procedure. I need a little help I wanted to implement a search Textbox for my datagridview in my windowsform application. How could I pass the @search in the storedprocedure to my windows application and send the value back to the stored procedure? Also if I am approaching this the wrong way please let me know Thanks.
SqlConnection connection = new SqlConnection(Configura开发者_如何学GotionManager.ConnectionStrings["ORCA"].ToString());
SqlCommand cmd = new SqlCommand("usp_getcardinfo", connection);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
As of right now this populates the datagridview just fine. Would like to get it so you can search and that record displays in the datagridview.
Thanks
Change your web method into parameter
[WebMethod]
public List<clubmembers> GetClubMembers(String search)
add statement before try catch
SqlParameter paramSearch = new SqlParameter ("@search",SqlDbType.VarChar);
paramSearch.Value = search;
cmd.Parameters.Add(paramSearch);
精彩评论