Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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=Rend er&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?
    Carpy Diem, it's .

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

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

    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:

    <code>Request.QueryString["QuoteKey"]</code>

    You do have to be somewhat concerned any time you allow user input to go into a query. I noticed this interesting comment:
    <hr>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...<hr>
    Source: Cutting Edge: Validating ASP.NET Query Strings @ MSDN.

  3. #3
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    The report viewer page doesn't have any code - just this...

    %@ Register TagPrefix="cc1" Namespace="Microsoft.Samples.ReportingServices" Assembly="ReportViewer" %>
    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="MinnReport.aspx.vb" Inherits="QCalculator.MinnReport"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <title>CalcReport</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    <meta name="vs_defaultClientScript" content="JavaScript">
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </HEAD>
    <body MS_POSITIONING="GridLayout" bgColor="#ffffcc">
    <form id="Form1" method="post" runat="server">
    <cc1:reportviewer id="RCalcRpt" style="Z-INDEX: 101; LEFT: -8px; POSITION: absolute; TOP: 16px"
    runat="server" Width="984px" Height="500px" ReportPath="/QCalculator/rptMinn" ServerUrl="http://mickey/reportserver"
    Toolbar="Default"></cc1:reportviewer>
    </form>
    </body>
    </HTML>


    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.
    Carpy Diem, it&#39;s .

  4. #4
    3 Star Lounger
    Join Date
    Jul 2001
    Location
    Minneapolis, Minnesota, USA
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    Just as an update, we're upgrading our asp.net, so hopefully, an easier solution will appear. Thanks for trying to help out here!
    Carpy Diem, it&#39;s .

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

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

    My guess is that you would pass the parameter here:

    <code>ReportPath="/QCalculator/rptMinn"</code>

    But it's just a guess.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •