Wednesday, 7 September 2011

C# Crystal Report Database

First we have to create a database named it as "crystaldb"
Create DataBase "crystaldb"
In the crystaldb database , create three tables
OrderMaster , OrderDetails , Product .
The Table Structure follows :
 OrderMaster
 OrderMaster_id
 OrderMaster_date
 OrderMaster_customer
OrderMaster_createduser

  OrderDetails
 OrderDetails_id
 OrderDetails_masterid
 OrderDetails_productid
OrderDetails_qty

  Product
 Product_id
 Product_name
Product_price

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













SQL command for creating tables are 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]

Enter some data to the tables :

From the following pictures you can see some data in the table for C# - Crystal Reports tutorial
Order Master Table Data







Order Details Table Data













Product Table Data


No comments:

Post a Comment