Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to assign datasource dynamically at runtime

Status
Not open for further replies.

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???

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top