Getsuyodev, Programming is mainly used when constructing an application. Programming requires knowledge of application domains, algorithms, and programming language expertise. Programming can be developed in different logic based on developer knowledge.

C# Crystal Reports sample databse



For generating Crystal Reports from C#, we need to connect a database and some tables with data. In the following section, you can see how to create a sample Database and Tables and the data for running of the following Crystal Reports – C# Tutorial. All examples in the CSharp Crystal Reports Tutorial is based on the following database.

First, we have to create a database named it as “crystaldb”

In the crystaldb database, create three tables

  1. OrderMaster
  2. OrderDetails
  3. Product

The Table Structure follows: OrderMaster

  1. OrderMaster_id
  2. OrderMaster_date
  3. OrderMaster_customer
  4. OrderMaster_createduser

OrderDetails

  1. OrderDetails_id
  2. OrderDetails_masterid
  3. OrderDetails_productid
  4. OrderDetails_qty

Product

  1. Product_id
  2. Product_name
  3. Product_price

The following picture shows the relation of tables in crystaldb database :

SQL command for creating tables follows:

CREATE TABLE [dbo].[OrderMaster] (
[OrderMaster_id] [int] NOT NULL ,
[OrderMaster_date] [datetime] NULL ,
[OrderMaster_customername] [varchar] (50),
[OrderMaster_createduser] [varchar] (50)
) ON [PRIMARY]
CREATE TABLE [dbo].[OrderDetails] (
[OrderDetails_id] [int] NOT NULL ,
[OrderDetails_masterid] [int] NULL ,
[OrderDetails_productid] [int] NULL ,
[OrderDetails_qty] [int] NULL
) ON [PRIMARY]
CREATE TABLE [dbo].[Product] (
[Product_id] [int] NOT NULL ,
[Product_name] [varchar] (50) ,
[Product_price] [numeric](18, 0) NULL
) ON [PRIMARY]

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More