Crystal Reports from SQL Query String
In usual practice , Crystal Reports we are getting from pre defined columns. But we can make Crystal Reports from Dynamic column . Here we are going to do the dynamic Crystal Reports from SQL statements . That is we enter SQL in textbox and get the Crystal Reports according to the SQL statement.
All Crystal Reports programming samples in this tutorials is based on the following database (crystaldb) . Please take a look at the database structure before you start this tutorial - Click here to see Database Structure .
Create a new VB.NET project and add a Strongly Typed Dataset . Before creating a Strongly Typed take a look at the detailed tutorial of create a strongly typed datset and add five column in the Datatable. Here we are limiting as five column , but you can add any number of column according to your requirements.
Next step is to create a Crystal Reports design from the Strongly Typed dataset.
Select all the column from dataset.
Select the default form(Form1.vb) and add a TextBox , Button and Crystal Reports Viewer .
Here we are going to pass the SQl statements to Crystal Reports at runtime . For that we parsing the SQL statement before we passing it to Crystal Reports. So we create a function for parsing SQL statements.
Public Function procesSQL() As String
Put the following vb.net source code in your form and run the program .
You have to provide the necessary databse information to Connection String.
- Sample Database and tables for Crystal Reports tutorials
- Step by Step help for creating a simple Crystal Reports in VB.NET
- VB.NET Crystal Reports from multiple tables
- VB.NET Crystal Reports String parameter
- VB.NET Crystal Reports Integer parameter
- VB.NET Crystal Reports Date parameter
- VB.NET Crystal Report Load Dynamically
- VB.NET Crystal Reports Formula Fields
- VB.NET Crystal Reports Summary Fields
- VB.NET Crystal Reports Export to PDF
- VB.NET Crystal Reports Export to Excel
- Email a Crystal Reports from VB.NET
- Crystal Reports Without Database
- Crystal Report from SQL Query String
- Crystal Reports from XML File
- Create a Subreport in Crystal Reports
- Create a Subreport in Crystal Reports with Link
- How to deploy Crystal Reports on Clinet Machine
- How to create Crystal Reports installer using Merge Modules