This is a migrated thread and some comments may be shown as answers.

Dynamic SelectCommand on DataSource by parameters

1 Answer 117 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
danparker276
Top achievements
Rank 2
danparker276 asked on 06 Apr 2011, 02:25 AM
I'm wondering the best way to do this.  Also I'm using silverlight report viewer so I can't give the reports the dataset.

I basically want to make the selectCommand dynamic like
Select a,b,c from tableA where d=1
if @paramter1="Z" then add " and z=1 "  to the query
Select a,b,c from tableA where d=1 and z=1

I could do this by stored procedure, but I'd rather not add another stored procedure to my database.
I could use filters, but I'm going to get too many rows back.

Can I make another SQL DataSource and bind it to my Report based on a parameter I send in?
Can I use iff() in the selectCommand ?

Using a stored procedure will work ok for me.  Just wondering if there's another way.

1 Answer, 1 is accepted

Sort by
0
danparker276
Top achievements
Rank 2
answered on 06 Apr 2011, 07:56 PM
Actually probably using a user function to change the datasource will work.  I'll look into that.
Tags
General Discussions
Asked by
danparker276
Top achievements
Rank 2
Answers by
danparker276
Top achievements
Rank 2
Share this question
or