I would like to be able to pass my stored procedure parameters on the querystring.
Is this possible? I read about the parameter dictionary but this seems a bit confusing. Is there a sample application to show how this is used?
I would still prefer to pass the parameters via querystring if possible.
Thanks,
Chris Dahlkvist
Querystring Parameters
Re: Querystring Parameters
Support · Jun 12, 2007Hello Chris,
Yes, you can pass the parameters in the query string and you will have to read these values from the query string and add them to the ParameterDictionary. Following is a sample line of code to read the values of a query string.
string queryValue = Request.QueryString["name"].ToString();
You can refer to the Report Parameters
topic on our help documentation to know about passing these parameters to the report.
Thanks,
ceTe Software Support Team.
Re: Querystring Parameters
Forum member · Jun 12, 2007I'm still confused. Here is what I have in my dplx:
<storedProcedure name="Report_DriverSettlementHeader">
<parameter name="DriverId" type="int" value="61420"/>
<parameter name="SettlementId" type="int" value="70000024"/>
Here is what I have in my vb:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Parameters.Add("DriverId", "61420")
Parameters.Add("SettlementId", "70000024")
DrawPdfToWeb("Settlements.pdf")
End Sub
I want both "DriverId" and "SettlementId" to come from the querystring.
I guess I must be slow because I have tried using the parameter dictionary and I just get errors. Once hard-coded it is fine. I must be missing something.
Re: Querystring Parameters
Support · Jun 12, 2007Hello Chris,
You can read the query string value and you can use it in the parameter dictionary without any problem. Following is the sample code for this.
If your URL with query string is some thing similar to this
http://localhost/WebForm1.aspx?name=value
' To read the query string value
Dim param as string = Request.QueryString("name").ToString()
' Add this parameter value to the parameter dictionary
Parameters.Add("parametername", param)
DrawPdfToWeb("pdfname.pdf")
You can send any number of parameter values using the query strings.
Thanks,
ceTe Software Support Team.
Re: Querystring Parameters
Forum member · Jun 12, 2007Again, I must be doing something wrong. Here is what I have now:
URL:
http://localhost/Reports/Settlements.aspx?DriverId=61420&SettlementId=70000024
In my vb:
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.ReportWriter
Public Class SimpleReport_StoredProc
Inherits DplxWebForm
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Parameters.Add("DriverId", param)
Parameters.Add("SettlementId", param2)
DrawPdfToWeb("Settlements.pdf")
End Sub
End Class
In my aspx:
<%@ Page Language="vb" Src="SimpleReport_StoredProc.aspx.vb" Inherits="SimpleReport_StoredProc"%>
<%
Dim MyParameters As ParameterDictionary = New ParameterDictionary()
Dim param as string = Request.QueryString("DriverId").ToString()
Dim param2 as string = Request.QueryString("SettlementId").ToString()
%>
In my dplx:
<?xml version="1.0"?>
<document xsi:schemaLocation="http://www.DynamicPDF.com http://www.DynamicPDF.com/schemas/DPLX4.xsd" version="4.0" id="Document" subject="Driver Settlement Report" title="Driver Settlement Report (Percent)" keywords="Driver Settlement Report Percent Linehaul Line Haul" xmlns="http://www.DynamicPDF.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<report id="Report1" pageSize="custom" pageHeight="612" pageWidth="1000">
<query dataProvider="msSql" id="SettlementHeader" connectionString="#Global.AppSettings["NorthwindConnectionString"]#">
<storedProcedure name="Report_DriverSettlementHeader">
<parameter name="DriverId" type="int" value="Parameters["DriverId"]"/>
<parameter name="SettlementId" type="int" value="Parameters["SettlementId"]"/>
<parameter value="" name="SettlementDate" type="varChar" size="10" direction="Output"/>
<parameter value="" name="DriverTotalPerSettlement" type="nVarChar" size="18" direction="output"/>
<parameter value="" name="YTDEarnings" type="nVarChar" size="18" direction="output"/>
<parameter value="" name="Ten99ThisStatement" type="nVarChar" size="18" direction="output"/>
<parameter value="" name="OtherIncomeThisStatement" type="nVarChar" size="18" direction="output"/>
<parameter value="" name="PreSettleBalance" type="nVarChar" size="18" direction="output"/>
<parameter value="" name="PostSettleBalance" type="nVarChar" size="18" direction="output"/>
</storedProcedure>
</query>
Re: Querystring Parameters
Support · Jun 12, 2007Hello Chris,
You do not have to use the ParameterDictionary and following is the sample code for your URL.
http://localhost/Reports/Settlements.aspx?DriverId=61420&SettlementId=70000024
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim param1 as string = Request.QueryString("DriverId").ToString()
Dim param2 as string = Request.QueryString("SettlementId").ToString()
Parameters.Add("DriverId", param1)
Parameters.Add("SettlementId", param2)
DrawPdfToWeb("Settlements.pdf")
End Sub
Please try the above code and see if it works. If you are getting any error then send over the error and the stack trace of the error you are getting.
Thanks,
ceTe Software Support Team.
Re: Querystring Parameters
Forum member · Jun 12, 2007You are correct. After I emailed you I realized I was switching back and forth between ASP and ASP.Net and Dimming in the wrong file.
I realize the question was not so much reading in the parameters as it is using them in the DPLX.
From my dplx:
<storedProcedure name="Report_DriverSettlementHeader">
<parameter name="DriverId" type="int" value="61420"/>
<parameter name="SettlementId" type="int" value="70000024"/>
How do I replace these with the values I pulled in from the querystring via the vb?
I have a couple other questions I will present after this is resolved.
These are pretty involved, complex reports and it seems that Cete is about the best option.
Currently this report is using 6 different stored procedures.
We sent in a P.O. but since we have not done business with you we will be contacting with a credit card.
Re: Querystring Parameters
Support · Jun 12, 2007Hello Chris,
Following is the sample line to add the parameters in the dplx.
<parameter name="@DriverId" type="int" value="#Parameters["CustomerID"]#"/>
You can add these parameters in the Query Editor window by clicking on the AddNew button selecting the Stored Procedure. You can open the query Editor window by clicking the Query property of the report section. You will have to set the value of the parametre to #Parameters["DriverId"]#. You can also refer to the SimpleReport_StoredProc example downloaded with the product download.
Thanks,
ceTe Software Support Team.
Re: Querystring Parameters
Forum member · Jun 12, 2007Worked perfectly.