Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

Getting Started with SSRS 2016 - Part 4

$
0
0

Prerequisite

We should have some basic knowledge in SQL Server Query and Visual Studio Tool for creating an SSRS Reports using Visual Studio 2015.

SQL Server Basic Query Visual Studio 2015

How to setup the SSRS Environment

If you want to know how to setup the SSRS Environment procedure, prerequisite and SSDT, please you can read out my previous article as below link

Getting Started with SSDT 2016 using Visual Studio 2015

How to create a Table in database

Firstly, create a Product table using SQL Server Management Studio in SQL Server database. Then, you can add product details in the Product table.

CREATE TABLE [dbo] . [Products] ( [ProductID] [int] IDENTITY ( 1 , 1 ) NOT NULL, [ProductName] [nvarchar] ( max ) NULL, [SupplierID] [int] NULL, [CategoryID] [int] NULL, [QuantityPerUnit] [nvarchar] ( max ) NULL, [UnitPrice] [decimal] ( 18 , 2 ) NULL, [UnitsInStock] [smallint] NULL, [UnitsOnOrder] [smallint] NULL, [ReorderLevel] [smallint] NULL, [SupplierName] [nvarchar] ( max ) NULL, [CategoryName] [nvarchar] ( max ) NULL, [Rating] [int] NOT NULL, [Discontinued] [bit] NOT NULL, CONSTRAINT [PK_dbo.Products] PRIMARY KEY CLUSTERED

(

[ProductID] ASC ) WITH ( PAD_INDEX = OFF , STATISTICS_NORECOMPUTE = OFF , IGNORE_DUP_KEY = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON ) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

GO

How to create an SSRS Project

Open Visual Studio 2015. Go to File menu, point to new and click new project. New Project Window will open, you can select an installed template like “Reporting Services” in Business Intelligence Template and then select the Report Server project and type Project Name SSRSMatrixReport. Choose the project location path and click OK button


Getting Started with SSRS 2016 - Part 4

Now, you can see EmployeeTableReport project structure, as shown in the screen-shot as below


Getting Started with SSRS 2016 - Part 4

How to create a new Report

You can see in details how to add new Report using Visual Studio 2015 in the Solution Explorer. You can see the step by step procedures as below

Go to the Reports folder, right-click the Reports folder and point to Add New Reports, then clicking the Add New Report.


Getting Started with SSRS 2016 - Part 4

The Report Wizard window will open and click the Next button


Getting Started with SSRS 2016 - Part 4

The Select the Data Source window will open and click the Edit button


Getting Started with SSRS 2016 - Part 4

The Connection Properties window will open and type the Server Name, Select the Authentication, User Name, Password, Select or Enter a database name and finally you can check the database connection succeed, followed by clicking the Test Connection button. Then Click the OK button.


Getting Started with SSRS 2016 - Part 4

The Select the Data Source window will open and select the new data source, connection string and click the Next button


Getting Started with SSRS 2016 - Part 4

The Design Query window will open and clicking the Query Builder


Getting Started with SSRS 2016 - Part 4

The Query Designer window will open and type the query in which table you want to load the report and executing the SQL query, followed by clicking the SQL icon. Then, Click OK button

select ProductID,ProductName, CategoryName, SupplierName, QuantityPerUnit, UnitPrice, Rating

Viewing all articles
Browse latest Browse all 3160

Trending Articles