I want to pass sql query from
vb.net to crystal report.
I am using crystaldecision.windows.forms.crstalreportviewr to view the report.
To use crviewr I have two options
1. Use Dim rptDocument As New ReportDocument as
crview.reportsouce= rptDocument (this line is ok)
but ReportDocument has no property or method like sqlquerystring, which I can pass from
vb.net to crystal report.
I also tried to populate the dataset with dynamic sql. It is pouplutating but when I assign dataset to ptDocument.SetDataSource(custDS) it still shows all records and donât shows those records which are just in dataset.
2. second option is one that I was using in
vb.6. In
VB.6 we can assign Public crydatasheet As CRAXDRT.Report to crviewer control where CRAXDRT.Report has method sqlquerystring. But in
vb.net we canât assign CRAXDRT.Report to crystaldecision.windows.forms.crstalreportviewr, because it gives error message wrong type when we use
crview.reportsouce= crydatasheet (error wrong type for reportsource)
Any suggestions? How can I pass sqlqeury to crystal report? The query joins several tables and where clause is being built dynamically according to the user selection of different fields from
vb.net form.
Thanks
Din