Asp. NET to create a chart using Crystal Reports

Source: Internet
Author: User

In many applications, reports are indispensable, a good report can visually let people grasp the situation of data, convenient decision-making. In this article, we will take a three-tier structure of the asp.net process as an example, introduce how to use the Crystal Report, to produce a statement, which introduces a lot of asp.net and Crystal report skills.

In this example, the application we envision is to produce a report for a sales department, where the manager can look at the sales over a period of time and reflect the sales trend in the form of a list or line chart. We'll use SQL Server 2000 as a database, using vb.net to write the middle-tier logic layer, while the presentation layer on the front end uses C #. Let's look at the structure of the database first.

The Tbitem table contains the items ordered in each order, Tbsales stores each order, Tblsalesperson is the salesperson's table, and every salesperson who holds the publisher.

Next, use SQL Server 2000来 to create these tables. The structure of the table looks like this:

CREATE TABLE [dbo].[tblItem] (
[ItemId] [int] NOT NULL ,
[Description] [varchar] (50) NOT NULL
) ON [PRIMARY]
CREATE TABLE [dbo].[tblSalesPerson] (
[SalesPersonId] [int] NOT NULL ,
[UserName] [varchar] (50) NOT NULL ,
[Password] [varchar] (30) NOT NULL
) ON [PRIMARY]
CREATE TABLE [dbo].[tblSales] (
[SaleId] [int] IDENTITY (1, 1) NOT NULL ,
[SalesPersonId] [int] NOT NULL ,
[ItemId] [int] NOT NULL ,
[SaleDate] [datetime] NOT NULL ,
[Amount] [int] NOT NULL
) ON [PRIMARY]

and use the following code to create a constraint relationship between tables.

ALTER TABLE tblItem
ADD CONSTRAINT PK_ItemId
PRIMARY KEY (ItemId)
GO
ALTER TABLE tblSalesPerson
ADD CONSTRAINT PK_SalesPersonId
PRIMARY KEY (SalesPersonId)
GO
ALTER TABLE tblSales
ADD CONSTRAINT FK_ItemId
FOREIGN KEY (ItemId) REFERENCES tblItem(ItemId)
GO
ALTER TABLE tblSales
ADD CONSTRAINT FK_SalesPersonId
FOREIGN KEY (SalesPersonId) REFERENCES tblSalesPerson(SalesPersonId)
GO

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.