Crystal Reports from SQL Query String
In VB.NET, Crystal Reports can be generated by utilizing SQL Query Strings. In this context, we develop a Strongly Typed dataset specifically designed for Crystal Reports. Additionally, we create a connection object and execute the SQL Query String to retrieve the required data.
It is essential to note that all the programming samples provided in these tutorials for Crystal Reports are based on the crystaldb database. Prior to commencing this tutorial, I recommend acquainting yourself with the structure of the database. To access the database structure, kindly click on the following link: Click here to view the Database Structure.
To acquire a comprehensive understanding of Crystal Reports creation, I suggest referring to the previous section of this tutorial. It provides detailed step by step Crystal Report guidance on creating Crystal Reports. Familiarizing yourself with the basics outlined in the step-by-step Crystal Report guide will prove beneficial before proceeding with this tutorial.
Generating a Strongly Typed DataSet
In the preceding section, a comprehensive tutorial was presented, detailing the process of create a strongly typed datset and designing Crystal Reports based on it. Once the dataset and Crystal Reports design have been established, the subsequent step involves creating a connection object and retrieving data from the database.
Select the default form (Form1.vb) you created in VB.NET and drag one button and CrystalReportViewer control to your form.
Put the following source code in the button click eventsFull Source VB.NET
You have to provide the necessary databse information to Connection String.