Solved

aspEasyPDF question

Posted on 2009-05-19
7
359 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ…
The purpose of this video is to demonstrate how to manually back up a WordPress Database. This will be demonstrated using a Windows 8 PC. The Host used will be IPage.com Log into your Hosting account. IPage will be used for demonstration : Locat…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now