bharathi228
Programmer
- Feb 12, 2009
- 12
Hello Experts,
Can any one suggest me Is it possible to assign datasource dynamically at runtime to crystal report(.rpt) with VB.NET 2.0??
I can only use Datasets in my case!! Typed-datasets are column-fixed right!!! But my data I assign is dynamic????
I actually gave a typed dataset having datatable with 4 fixed column as datasource to crystal report .rpt at design time
Below is my piece of code
Dim mydt As DataTable = New DataTable
schemadt = DummyTable() 'Function to retrieve Data Table
Dim report As CrystalReportDemo = New CrystalReportDemo ' Crystal report
report.Database.Tables("DataTable1").SetDataSource(CType(mydt, DataTable))
CrystalReportViewer1.ReportSource = report
Here DataTable1 is a typed dataset, where I just added 4 columns say NUMBER, ADDRESS, ZIP, CITY.I assigned this dataset at design time to CrystalReportDemo.rpt file(through standard wizard-->ADO.NET datasets)
Problem here is everytime the Dummy Data Table i get is not static(always not the above 4 columns..more new columns do come in Datatable)...How to work it out guys?? I am new to Crystal reports.Is there any way to dynamically bind new columns to report.
And secondly the report is doing auto-formatting of columns???
Can any one suggest me Is it possible to assign datasource dynamically at runtime to crystal report(.rpt) with VB.NET 2.0??
I can only use Datasets in my case!! Typed-datasets are column-fixed right!!! But my data I assign is dynamic????
I actually gave a typed dataset having datatable with 4 fixed column as datasource to crystal report .rpt at design time
Below is my piece of code
Dim mydt As DataTable = New DataTable
schemadt = DummyTable() 'Function to retrieve Data Table
Dim report As CrystalReportDemo = New CrystalReportDemo ' Crystal report
report.Database.Tables("DataTable1").SetDataSource(CType(mydt, DataTable))
CrystalReportViewer1.ReportSource = report
Here DataTable1 is a typed dataset, where I just added 4 columns say NUMBER, ADDRESS, ZIP, CITY.I assigned this dataset at design time to CrystalReportDemo.rpt file(through standard wizard-->ADO.NET datasets)
Problem here is everytime the Dummy Data Table i get is not static(always not the above 4 columns..more new columns do come in Datatable)...How to work it out guys?? I am new to Crystal reports.Is there any way to dynamically bind new columns to report.
And secondly the report is doing auto-formatting of columns???