C# Crystal Reports Tutorial pot

71 634 1
C# Crystal Reports Tutorial pot

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

C# Crystal Reports Tutorial C# Crystal Reports Tutorial 1.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" 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 2. C# Crystal Reports step by step A step by step tutorial for beginners who is creating their Crystal Reports for the first time in C#. All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb. So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb Here we are going to create a new Crystal Reports in C# from Product table in the above mentioned database crystalDB. The Product Table has three fields (Product_id,Product_name,Product_price) and we are showing the whole data from Product table to the C# - Crystal Reports project. Open Visual Studio .NET and select a new CSharp Windows project. Now you will get the default Form1.cs. From the main menu in Visual Studio C# project select PROJECT >Add New Item . Then Add New Item dialogue will appear and select Crystal Reports from the dialogue box. Select Report type from Crystal Reports gallery. Accept the default settings and click OK. Next step is to select the appropriate connection to your database (here crstaldb). Here we are going to select OLEDB Connection for SQL Server to connect Crystal Reports in C#. Select OLE DB (ADO) from Create New Connection . Select Microsoft OLE DB Provider for SQL Server . The next screen is the SQL Server authentication screen for connecting to the database - crystalDB. Select your Sql Server name , enter userid , password and select your Database Name . Click next , Then the screen shows OLE DB Property values , leave it as it is , and then click finish button. After you click the finish button , the next window you will get your Server name under OLEDB Connection, from there selected database name (Crystaldb) and click the tables , then you can see all your tables from your database. From the tables list double click the Product table then you can see the Product table will come in the right side list. Click Next Button Select all fields from Product table to the right side list . Click Finish Button. Then you can see the Crystal Reports designer window in your C# project. In the Crystal Reports designer window you can see the selected fields from Product table. You can arrange the field Objects and design of the screen according your requirements. After that your screen is look like the following picture. Now the designing part is over and the next step is to call the Crystal Reports in your C# application and view it through Crystal Reports Viewer control in C#. Select the default form (Form1.cs) you created in C# and drag a button and a CrystalReportViewer control to your form . After you drag the CrystalReportViewer to your form , it will look like the following picture. You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code. using CrystalDecisions.CrystalReports.Engine; Copy and paste the following source code and run your C# project [...]... Here C# crystaldb If you are new to Crystal Reports and do not know how to create Crystal Reports from C# , please take a look at the section step by step tutorial for creating a Crystal Reports from C# In the previous sections , we already saw how to pass a string parameter to Crystal Reports - C# Crystal Reports String Paramater, how to pass an Integer parameter to Crystal Reports - C# Crystal Reports. .. real-time values 8 C# Crystal Reports Formula Field The following C# - Crystal Reports section describes how to add a formula field in the Crystal Reports All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb If you are new to Crystal Reports and... Click Here C# crystaldb If you are new to Crystal Reports and do not know how to create Crystal Reports from C# , please take a look at the section step by step tutorial for creating a Crystal Reports from C# Here we pass a String parameter from C# to Crystal Reports For example , from C# program we pass a customer name as a parameter and show all the orders of that customer to the Crystal Reports In... following picture C# Crystal Reports Integer parameter The following section describes the how to pass an Integer Parameter to Crystal Reports from C# All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb If you are new to Crystal Reports and do... cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt"); crystalReportViewer1.ReportSource = cryRpt; crystalReportViewer1.Refresh(); } } } cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt"); The Crystal Reports file path in your C# project files location, there you can see CrystalReport1.rpt So give the full path name of Crystal Reports file like c:\projects\crystalreports\CrystalReport1.rpt... is over and the next step is to call the Crystal Reports in C# and view it in Crystal Reports Viewer control Select the default form (Form1.cs) you created in C# and drag a button and a CrystalReportViewer control to your form You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared; Copy and paste... values 4 .C# Crystal Reports from multiple tables The following section describes how to create Crystal Report from multiple tables in C# All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb Here we are going to generate Crystal Reports from... is over and the next step is to call the Crystal Reports in C# and view it in Crystal Reports Viewer control Select the default form (Form1.cs) you created in C# and drag a button and a CrystalReportViewer control to your form You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared; Copy and paste... runtime on Crystal Reports login In this section we are passing User ID , Password , Server Name and Database Name dynamically to Crystal Reports from C# All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb If you are new to Crystal Reports. .. is over and the next step is to call the Crystal Reports in C# and view it in Crystal Reports Viewer control Select the default form (Form1.cs) you created in C# and drag a button and a CrystalReportViewer control to your form You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared; Copy and paste . C# Crystal Reports Tutorial C# Crystal Reports Tutorial 1 .C# Crystal Reports sample databse For generating Crystal Reports from C# , we need to connect a database. The Crystal Reports file path in your C# project file location, there you can see CrystalReport1.rpt . So give the full path name of Crystal Reports file like c:projectscrystalreportsCrystalReport1.rpt. runtime on Crystal Reports login . In this section we are passing User ID , Password , Server Name and Database Name dynamically to Crystal Reports from C# . All C# Crystal Reports Tutorial in

Ngày đăng: 30/07/2014, 19:22

Từ khóa liên quan

Mục lục

  • C# Crystal Reports Tutorial

  • 1.C# Crystal Reports sample databse

  • 3.C# Crystal Reports Dynamic Logon parameters

  • 4.C# Crystal Reports from multiple tables

  • 5. C# Crystal Reports String parameter

  • C# Crystal Reports Integer parameter

  • 6. C# Crystal Reports Date parameter

  • 7. C# Crystal Reports Dynamic Logon parameters

  • 8. C# Crystal Reports Formula Field

  • 9. C# Crystal Reports Summary Field

  • 10. C# Crystal Reports Export to Pdf

  • 11. C# Crystal Reports Export to Excel

  • 12. Email Crystal Reports from C# Application

  • 13. C# Crystal Reports without database

  • 14. C# Crystal Reports from SQL Query

  • 16. C# Crystal Reports - sub reports

  • 17. C# Crystal Reports - on demand sub reports

  • 18. C# Crystal Reports - Date to Date

  • 19. How to print Crystal Reports in C#

  • 20. How to deploy Crystal Report

Tài liệu cùng người dùng

Tài liệu liên quan