I'm creating a web api method where i could select all products under a given list of category id's as parameter
c# method would be:
        [Route("api/products/search")]
        public HttpResponseMessage SearchProducts([FromUri] int[] categoryIds)
        {
        DataSet ds = new DataSet();
        using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[connection_string].ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("sp_search_product_by_category", con);
            cmd.Parameters.AddWithValue("category_ids", categoryIds);
            cmd.CommandType = CommandType.StoredProcedure;
            con.Open();
            SqlDataAdapter adp = new SqlDataAdapter();
            adp.SelectCommand = cmd;
            adp.Fill(ds);
        }
        var message = Request.CreateResponse(HttpStatusCode.OK, ds.Tables[0]);
        return message;
        }
And then sp would be:
CREATE PROCEDURE [dbo].[sp_search_product_by_category] 
    -- Add the parameters for the stored procedure here
    @category_ids [some_array_data_type] <-- what should be in here?
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;
    -- Select statements for procedure here
    SELECT * from products where category in @category_ids
END
How would i let the SP know that its an array, and make it select appropriately?
Any help would be appreciated
 
    