Link to home
Start Free TrialLog in
Avatar of SkipFire
SkipFire

asked on

ASP.NET & SQL Reporting Querystring Parameters

I am working on my first SQL Report and ahve the report designed, and I have my SQL statement with no dynamic parameters done.  Now I want to integrate it into a web site and have the website pass a querystring with the value for a single parameter for the SQL statement to use.  The condition I want to add is District_Name = '<passed value>'.  I have gone through several walkthroughs but have not been able to get it to work.  So, what are the steps for me to add the condition to my where clause in the report so that it reads the value from the query string, and what should that part of the querystring look like?
Avatar of Nazermohideeen
Nazermohideeen

post the code that u use now.

if you build the SQL inside the applicaiton, you just have to add the where clause to the SQL using normal string concat
eg
sql = "select * from table where District_name = " + Request.QueryString("District_name")
sqlcmd.commandText = sql
sqlcmd.executeReader() ' Or how ever u wish to invoke the query

or

sql = "select  * from table where district_name = @param1"
sqlcmd.commandText = sql
sqmcmd.parameters.addwithValue("@param1", Request.queryString("District_name"))
sqlcmd.executeReader()


NM

NM
Avatar of SkipFire

ASKER

Right now I am just doing a response.redirect to the URL of the report, the SQL is currently in the data tab on the report designer.
ASKER CERTIFIED SOLUTION
Avatar of Nazermohideeen
Nazermohideeen

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.  I ended up abandoning this line as I was able to convince the client to go to the embedded control on their website.