Databases Reference
In-Depth Information
Hands-on exercise 5.3 - creating a report that
has a subreport
We will be using the same data source, the
Northwind
database on SQL Server
2012 KAILUA for both the main report as well as the subreport. The subreport
is embedded (placed inside) in the main report.
In the following section we will create a subreport, which will later be inserted
into the main report.
Creating the subreport
1.
Create a data source
DataSource1
(default name) from the
Northwind
database. Use the following connection string and test it:
Data Source=HODENTEKWIN7\\KAILUA; Initial Catalog=Northwind
2.
Create a dataset with the following properties (items that you use in
the wizard):
° Name:
QryProducts
° Query type:
text
° Dataset is embedded in the report;
° Query:
SELECT
Products.ProductName, Products.CategoryID AS [Products CategoryID]
,Products.ProductID ,Products.UnitPrice ,Products.UnitsInStock
,Categories.CategoryID AS [Categories CategoryID]
FROM
Categories
INNER JOIN Products ON Categories.CategoryID = Products.
CategoryIDWHERE Categories.CategoryID = @CategoriesCategoryID
3.
Drop a table from the
Insert
menu and populate the cells of the table with the
values. The
ExecutionTime
variable is normally in the footer. Herein, it has
been shifted to a blank row of the table and centered. If the main report has
an execution time, it may not be even necessary.
Search WWH ::
Custom Search