Problem with connection

naresh

Active member
Joined
Jul 4, 2006
Messages
38
Programming Experience
1-3
Hi, I am new to crystal reports. I have connected the datasource to the reports and it is working fine. But what i need is we will give the connection dynamically. How to connect the datasource dynamically rather that using the design view. any help is appreciated.

Thanks in advance.
Naresh
 
Crystal reports PUSH method

When you call your report to view/print, have the datatable defined and filled.
Then pass that datatable to the report.

Example with subreport if needed:


Dim YourRpt As New YourCrystalReport
YourRpt.SetDataSource(YourDataTable)
YourRpt.OpenSubreport("YourCrystalReportSub.rpt").SetDataSource(YourSubDataTable)
 
another problem

Thanks David, I think , i posted the thread with the different meaning. besides that here is my Question again. I am working with the database suppose "MARKET" and i prepared the crystal reports accoring to that database. but my client system has "SHOPPING" database which is identical , Every thing is same eccept name of the database and the servername is systemName\Shopping in the client system. Now my problem is the reports should connnect to the client database when i deploy my project. I think my problem is clear.

I came with one solution :
In my system :
Dim obj As New Properties
Dim ser As String = My.Computer.Name
obj.DataSourceConnections.Item(0).SetConnection(ser, "Market", True)

I will change the ser name and database name when i give to the client system
Dim obj As New Properties
Dim ser As String = My.Computer.Name & "\shopping"
obj.DataSourceConnections.Item(0).SetConnection(ser, "shopping", True)

It worked fine when i checked in the side by system will it give any errors in future or any other solution for this problem.
Thanks for any help.
Naresh
 
Back
Top