Solved

aspEasyPDF question

Posted on 2009-05-19
7
367 Views
Last Modified: 2012-05-07
Dear Experts

I am using aspEasyPDF to generate a PDF output.  I have session variables, for example pPrice.  I am using the code below which is the syntax to return the records contained within the PDF.  

My session variable is called pPrice and I wondered how to correctly amend the syntax below to use the session variable (pPrice) to replace the entered value 250000?

Thanks for any suggestions

Grant
fp_sQry = "SELECT * FROM dbo.Property  WHERE pPrice >= 250000   ORDER BY pPrice DESC"

Open in new window

0
Comment
Question by:grantballantyne
  • 4
  • 3
7 Comments
 
LVL 12

Expert Comment

by:R_Harrison
ID: 24426106
Try the below, I assume pPrice is a numeric value?
fp_sQry = "SELECT * FROM dbo.Property  WHERE pPrice >= " & Session("pPrice") & "   ORDER BY pPrice DESC"
 

Open in new window

0
 

Author Comment

by:grantballantyne
ID: 24426211
Thanks for the suggestion.  I have tried this and I get the following error within the PDF

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the keyword 'ORDER'.
/easi/CMS/pdfreports/propertyresults_adv_pdf.asp , line 116
0
 
LVL 12

Expert Comment

by:R_Harrison
ID: 24426249
The below is for non-numeric.    What is the value of Session("pPrice")??
fp_sQry = "SELECT * FROM dbo.Property  WHERE pPrice >= '" & Session("pPrice") & "' ORDER BY pPrice DESC"
  

Open in new window

0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:grantballantyne
ID: 24426700
Thanks again R Harrison.

The PDF is generated using the above but the Session value is ignored?
0
 
LVL 12

Accepted Solution

by:
R_Harrison earned 500 total points
ID: 24426869
Have you checked that Session("pPrice") has a value?

You could add a line above, such as
Session("pPrice")=25000
and see if it works, if so then the error is with the session value and you will need to post more code for me to troubleshoot it.
0
 

Author Comment

by:grantballantyne
ID: 24432810
Thanks R Harrison.

By entering a fixed value for the session it seems to work fine for example <%Session("pMinPrice") = 250000 %>

It appears that the only way to push through a value for the Session is to append it to the URL from the previous page.  However I have a similar problem with the previous page as to how to code this.

Please see code below which is the previous page.

<%
 
' Example that read an html file and renders it
' to PDF.
' This version is to show the Professional feature
' to read html files.	
 
' Clear out the existing HTTP header information
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
Response.ContentType = "application/pdf"
 
dim PDF
 
set PDF = server.createobject("aspPDF.EasyPDF")
 
PDF.License("EasyPDF.lic")
 
' Set margins for the page
PDF.SetMargins 20,20,20,20
 
'FileName = Server.MapPath("pdf_html_dbtables1.asp")
'PDF.AddHtml( "http:///" & FileName )
 
PDF.AddHtml( "http://dev.easiproperty.net/easi/CMS/pdfreports/propertyresults_adv_pdf.asp" )
 
 
PDF.BinaryWrite
 
set pdf = nothing
 
%>

Open in new window

0
 

Author Comment

by:grantballantyne
ID: 24432917
Thanks for all your help with this.

I have used the following:  PDF.AddHtml( "http://dev.easiproperty.net/easi/CMS/pdfreports/propertyresults_adv_pdf.asp?pMinPrice=" & Request.QueryString("pMinPrice")  )

which has worked.  
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

803 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