Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 5. Using Parameters

Chapter 5. Using Parameters

In the previous chapter, we created a SalesDetails report, which shows the Product Name, Unit Price, Sales Quantity, Total, and Grand Total of Sales No : 1 (One). This report shows the data of only Sales No. 1. So what will we do if we want to see the details of Sales No. 2, or 3, or others? Of course, we will not develop reports for each Sales No. because thousands of Sales Nos. will be generated. We will use a technique where we will develop only one report, which will work for any Sales No. In the SalesDetails report of Chapter 4, Using Variables, we hardcoded the SalesNo in the SQL commands. That's why it works only for Sales No. 1. In this chapter, we will use parameters instead of hardcoded data in the report. Recall that we wrote the following SQL query in the SalesDetails report:

SELECT
  Product.Name AS ProductName,
  SalesLine.SalesQuantity AS SalesQuantity,
  SalesLine.UnitSalesPrice AS UnitPrice
FROM
  Sales, SalesLine, Product
WHERE
  Sales.SalesNo=SalesLine.SalesNo
  AND Product.ProductCode=SalesLine.ProductCode
  AND Sales.SalesNo=1


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint