I have added the stored procedure as a data source (see attached text file for coding). Using the wizard, I tested it by setting values for each parameter and it returned results (see attached snapshot). Note: All data is test data and is not true.
I went into the report and specified the parameters (see attached snapshot).
In the ASP page, I added some code I found via blogs/google for passing parameters to reportviewer using VB Script. I was going to upload the page as a file but the attach keeps failing so I am putting the asp page code below.
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="rptAvgDailyPatients.aspx.vb" Inherits="AKSMReporting.rptAvgDailyPatients" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server" language="vbscript" type="text/vbscript">
Sub cmdRunReport_Click(ByVal sender As Object, ByVal e As EventArgs) Handles cmdRunReport.Click
Dim reportparam0 As Integer = sLoc.Value
Dim reportparam1 As Date = sDate.Value
Dim reportparam2 As Date = eDate.Value
Dim p(2) As ReportParameter
p(0) = New ReportParameter("Loc", reportparam0)
p(1) = New ReportParameter("sDate", reportparam1)
p(2) = New ReportParameter("eDate", reportparam2)
rvAvgDailyPat.LocalReport.SetParameters(p)
rvAvgDailyPat.LocalReport.Refresh()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Oncology - Avg Daily Patients Report</title>
</head>
<body>
<form id="frmAvgDailyPatients" runat="server" action="rptAvgDailyPatients.aspx" method="post" >
<div align="center">
<table cellspacing="0" cellpadding="0" border="0" width="900">
<tr>
<td align="center">Location:</td>
<td><input type="text" name="sLoc" id="sLoc" value="1" runat="server" /></td>
<td align="center">Start Date:</td>
<td><input type="text" name="sDate" id="sDate" value="1/1/2011" runat="server" /></td>
<td align="center">End Date:</td>
<td><input type="text" name="eDate" id="eDate" value="12/1/2011" runat="server" /></td>
<td align="center"><asp:Button ID="cmdRunReport" runat="server" Text="Run Report" /></td>
</tr>
<tr><td colspan="7"> </td></tr>
</table>
</div>
<div align="center">
<rsweb:ReportViewer ID="rvAvgDailyPat" runat="server" Font-Names="Tahoma"
Font-Size="10pt" forecolor="white" Height="8in" Width="11in" BackColor="#003366"
Font-Bold="True" LinkActiveColor="White" LinkActiveHoverColor="White"
LinkDisabledColor="LightGray">
<LocalReport ReportPath="rptAvgDailyPatients.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="dsAvgDailyPatients"
Name="qryAvgDailyPat_spAvgDailyPatients" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="dsAvgDailyPatients" runat="server"
SelectMethod="GetData"
TypeName="AKSMReporting.qryAvgDailyPatTableAdapters.spAvgDailyPatientsTableAdapter">
</asp:ObjectDataSource>
</div>
</form>
</body>
</html>
When I debug the page locally, I just see the three inputs and the button. I set default values to the inputs for my ease. When I press the button, it appears to run code (I see a process bar clocking at the bottom), but the report does not appear.
Anybody have some ideas as to why this is not working or have a better suggestion for approach/execution? Also, if anyone has any suggestions to a good resource book or website for VBScript against MS ReportViewer, I would really appreciate it. If I get this working, my bosses want me to do a lot in this.
Thx in advance for any assistance.
Attached image(s)
Attached File(s)
-
StoredProcedure.txt (687bytes)
Number of downloads: 27

New Topic/Question
Reply



MultiQuote



|