?
Solved

ASP.NET & SQL Reporting Querystring Parameters

Posted on 2007-08-08
4
Medium Priority
?
768 Views
Last Modified: 2013-12-17
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?
0
Comment
Question by:SkipFire
  • 2
  • 2
4 Comments
 
LVL 4

Expert Comment

by:Nazermohideeen
ID: 19656003
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
0
 
LVL 4

Author Comment

by:SkipFire
ID: 19656275
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.
0
 
LVL 4

Accepted Solution

by:
Nazermohideeen earned 1500 total points
ID: 19656346
0
 
LVL 4

Author Comment

by:SkipFire
ID: 19668931
Thanks.  I ended up abandoning this line as I was able to convince the client to go to the embedded control on their website.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question