0
votes

I have a Query Result stored in a Data Table, now i want to use these results to create a Crystal Report, I'm new in crystal reports, I'm trying to use the wizard options but they don't ask me for use DataTable values they only have communication directly with the tables of the database.

1
Try this.Asad Ali

1 Answers

4
votes

Crystal Report supports Command facility. You can add command to crystal report by creating a non-table query. for example

Select Cast(0 As smallint) As ID, Cast('' As Varchar(50)) As FName, Cast('' As Varchar(50)) As  LName

And add above query to Crystal Report Command. This command will be perform as a Sql Table. After creating a proper design you can assign that data table to crystal report by SetDataSource()

Dt.TableName = 'Command1";
crReport1.Database.SetDataSource(Dt);

This crystal report datasource known as Disconnecte Datasource. You don't need to assign connection property or any logon info to crystal report for this. But, Once you need to create a temporary SQL Connection in crystal report to create command.