Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dropdownlist as a parameter

Status
Not open for further replies.

Nejibg

Programmer
Apr 4, 2008
16
GB
Hi All,

I have a dropdownlist which contains different ProdutIds.

I have to use the values from the dropdownlist as a parameter to the report. How to use the dropdownlist to the Report?

Thanks for your help.

N.

 
What are you using this in? VB.net?

--------------------------
Web/.net Programmer & DBA
Central PA
 
Hi,
Thanks for your reply.
I'm using the Visual Studio .NET integrated Report Designer.
 
I'm not sure I've used that before. I do have a VB.net solution that takes the value of a dropdown box and passes it to a report. Would you like that code?

--------------------------
Web/.net Programmer & DBA
Central PA
 
Are you saying you have a .NET app which has a dropdown list that you need to pass to a parameter in a SSRS report or that you have created an SSRS report which has a report parameter which has a list of values that you want to pass to the SQL which generates the data?

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thanks for your reply.
I'm not writing any .Net code. I just created an SSRS report which has report params. One of them is a dropdownlist, which I'd like to pass its selected items to my sql function in a comma delimited format (UserSelectedCountries).
My code is:

SELECT companies,Countries
FROM [ReportsDb].dbo.MyTable
WHERE [dbo].[fn_FindStringInString](CampanyCountries,UserSelectedCountries) ='TRUE'

I hope you'd be able to help.
Thanks again.
 
Not sure about splitting the list but the default way to pass a param to SQL in SSRS is:

WHERE FieldName = @ParameterName


so in your case, something like:

SELECT companies,Countries
FROM [ReportsDb].dbo.MyTable
WHERE [dbo].[fn_FindStringInString](CampanyCountries,UserSelectedCountries) ='TRUE'
And ProductID = @ParameterName

should work - substituting in your parameter name and field name - if you need to pass more than 1 product ID, I think you have to use something like a "split" function to convert the values to a comma seperated string but I am on SSRS 2000 that doesn;t have this functionality so can;t say for sure

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top