![]() ![]()
Here we are connecting the related fields from each table. The next step is to make relation between these selected tables. Select all table from the table list to right side list box, because we are creating report from three tables ( OrderMaster, OrderDetails, Product). Then you will get your Server name under OLEDB Connection from there select database name (Crystaldb) and click the tables, then you can see all your tables from your database. Click next, Then the screen shows OLE DB Property values, leave it as it is, and click finish. #CRYSTAL REPORT VB NET PASSWORD#Select your Sql Server name, enter userid, password and select your Database Name. Next screen is the SQL Server authentication screen. Then Add New Item dialogue will appear and select Crystal Reports from the dialogue box. NET Project.įrom main menu in Visual Studio select PROJECT->Add New Item. Here we have three table (ordermaster, orderdetails amd product ) and we are generating report from these three tables by connecting each tables with their related fields. Here we are going to do is to generate Crystal Reports from multiple tables. Please take a look at the database structure before you start this tutorial - Click here to see Database Structure. VB.NET Crystal Reports from multiple tables All Crystal Reports programming samples in this tutorials is based on the following database (crystaldb). #CRYSTAL REPORT VB NET CODE#After you run the source code you will get the report like this. ![]() #CRYSTAL REPORT VB NET FULL#So give the full path name of report here. NOTES: cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt") The Crystal Reports is in your project location, there you can see CrystalReport1.rpt. Put the following source code in the button click event Next : VB.NET Crystal Reports from multiple tablesĭownload Source Code Print Source Code Imports Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clickĭim cryRpt As New ReportDocument cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt") CrystalReportViewer1.ReportSource = cryRpt CrystalReportViewer1.Refresh() End Sub End Class Select Form's source code view and put the code on top. Select the default form (Form1.vb) you created in VB.NET and drag a button and CrystalReportViewer control to your form. Now the designing part is over and the next step is to call the created Crystal Reports in VB.NET through Crystal Reports Viewer control. Your screen look like the following picture. You can arrange the design according your requirements. Then you can see the Crystal Reports designer window. Ĭlick Next Button Select all fields from Product table to the right side list.Ĭlick Finish Button. From the tables list select Product table to the right side list. ![]() Select Microsoft OLE DB Provider for SQL Server. Here we are going to select OLEDB connection for SQL Server Select OLE DB (ADO) from Create New Connection. Next step is to select the appropriate connection to your database. Select Report type from Crystal Reports gallery.Īccept the default settings and click OK. From main menu in Visual Studio select PROJECT->Add New Item. The Product Table has three fields (Product_id,Product_name,Product_price) and we are showing the whole table data in the Crystal Reports. NET Project.Ĭreate a new Crystal Reports for Product table from the above database crystalDB. All Crystal Reports programming samples in this tutorials is based on the following database (crystaldb). OrderDetails_id OrderDetails_masterid OrderDetails_productid OrderDetails_qty OrderMaster_id OrderMaster_date OrderMaster_customer OrderMaster_createduser Give the database name as "crystaldb" Create a DataBase "crystaldb" In the crystaldb database, create three tables. All examples in the VB.NET Crystal Reports Tutorials are based on the following database. ![]() #CRYSTAL REPORT VB NET HOW TO#VB.NET Crystal Reports for Beginners Sample Database for running Crystal Reports tutorials In the following section you can see, how to create a sample Database and Tables and data for running Crystal Reports Tutorials. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |