• pass a key to sql report (asp.Net 1.1 SQL2003)

    Home » Forums » Developers, developers, developers » DevOps Lounge » pass a key to sql report (asp.Net 1.1 SQL2003)

    Author
    Topic
    #453008

    I’m trying to get an aspx page where there’s a reportviewer box containing a sql reporting services report that needs a variable. The variable comes from a previous .aspx page (page a) and I’ve gotten the variable to go over to the sql report page (page . I can see that the variable is on the URL address on page b; but for the life of me, I can’t figure out how to get that variable to feed into the report.

    Here’s sort of what I have behind the button from page a to page b(QalcReport.aspx):


    Private Sub btnReport(Byval sender as System.Object, byVal e as System.EventArgs)
    dim strRef as string
    strRef = Request.QueryString(0)
    response.Redirect(“QalcReport.aspx?rs:Command=Render&QuoteKey=” & strRef)

    end sub

    I know this probably works in asp.net 2.0 and above, but we can’t go there yet. Any suggestions?

    Viewing 0 reply threads
    Author
    Replies
    • #1120154

      What is the code for creating a report viewer box — does it include the database query or other way to provide parameters? Try feeding it this:

      Request.QueryString["QuoteKey"]

      You do have to be somewhat concerned any time you allow user input to go into a query. I noticed this interesting comment:[indent]


      Starting with version 1.1, ASP.NET preprocesses any posted data (forms and query string), looking for suspicious combinations of characters that may be exploited by XSS attackers.But this barrier is not a silver bullet…


      [/indent]Source: Cutting Edge: Validating ASP.NET Query Strings @ MSDN.

      • #1120218

        The report viewer page doesn’t have any code – just this…

        %@ Register TagPrefix=”cc1″ Namespace=”Microsoft.Samples.ReportingServices” Assembly=”ReportViewer” %>

        CalcReport

        I was thinking of putting something in the PageLoad() but I didn’t want to put a query into the mix. Oh, and I changed the names to protect the innocent, so if I mixed something up here, rest assured the code actually works in real life.

        • #1120305

          My guess is that you would pass the parameter here:

          ReportPath="/QCalculator/rptMinn"

          But it’s just a guess.

      • #1120278

        Just as an update, we’re upgrading our asp.net, so hopefully, an easier solution will appear. Thanks for trying to help out here!

    Viewing 0 reply threads
    Reply To: pass a key to sql report (asp.Net 1.1 SQL2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: