Dynamic SelectCommand on DataSource by parameters

2 posts, 0 answers
  1. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 05 Apr 2011 Link to this post

    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.
  2. danparker276
    danparker276 avatar
    389 posts
    Member since:
    Aug 2010

    Posted 06 Apr 2011 Link to this post

    Actually probably using a user function to change the datasource will work.  I'll look into that.
  3. DevCraft banner
Back to Top