I am passing A multi Value throught parameter to a stored procedure and When a multivalue is passed to a parameter it fails as you have too many arguments when ever i select multi value parameter.
Can you please assit me how to pass a Multi value parameter.
Thanks,
Ravi
3 Answers, 1 is accepted
You can find detailed info on using multi-value parameters in our documentation: Using Multivalue Parameters.
Kind regards,
Elian
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >
The DataSource Components do not support MultiValue Report Parameter for Stored Procedures because it is based on ADO.NET and does not allow you to pass a collection of values (set, array). The SqlDataSource component supports parametrized SQL queries by associating the parameters you add to the Parameters collection with placeholders in the SelectCommand query. Parameter values can be evaluated with any expression which conforms to the common expression syntax supported by the reporting engine. This grants you a great deal of flexibility on how you can supply your SQL queries with parameters. Unfortunately the above approach is not applicable for stored procedures.
As a workaround our suggestion is to set the SqlDataSource parameter to a comma separated string of the values. I have attached a sample report as an example. In order to run it you will need the AdventureWorks database that came with your installation of Telerik Reporting. Additionally you will need GetByProductNames stored procedure:
USE [AdventureWorks]
GO
SET
ANSI_NULLS
ON
GO
SET
QUOTED_IDENTIFIER
ON
GO
CREATE
PROCEDURE
[dbo].[GetByProductNames]
@Names nvarchar(
MAX
)
AS
BEGIN
SELECT
p.ProductID, p.
Name
, p.Color
FROM
Production.Product
AS
p
WHERE
CHARINDEX(
','
+ p.
Name
+
','
,
','
+ @Names +
','
) > 0
END
Regards,
Peter
the Telerik team
BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >