I am tring to change the database at runtime using crystal reports .net. I can dot it with SQL Server using the report.SetDatabaseLogIn and the TableLogOnInfo.
But how do I do it with access? There doesn't seem a way to do it with local databases.
I am tring to change the database at runtime using crystal reports .net. I can dot it with SQL Server using the report.SetDatabaseLogIn and the TableLogOnInfo.
But how do I do it with access? There doesn't seem a way to do it with local databases.
I don't know how to specifically answer your question, but I will help you out in dealing with Crystal Reports. After having a co-worker troubleshooting Crystal problems for over two weeks, he figured out the most easy way to deal with Crystal Reports.
The secret is using Strongly Typed DataSets as the datasource. In code, you fill the Strong Typed DataSet, and then you set the source of the report to that. After we switched to doing that, our reports ran faster, and they didn't cause us all the security headaches we had before.
The best part would be that in your situation, it wouldn't matter from where the data came from to populate the dataset, the report wouldn't care at all as long as there is data in the dataset that matches the report requirements.
Good luck, and sorry that I couldn't help you specifically.
I need to change the access database at runtime.
This used to be done with datafiles property.
Can you do it in .NET?
If you mean you need to change database on which the report is based, this may help you. If your report is called myReport and the CR viewer is called CRV then:VB Code:
Dim rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument Dim tbl As CrystalDecisions.CrystalReports.Engine.Table rpt = New myReport For Each tbl In rpt.Database.Tables Dim tbllogin As New CrystalDecisions.Shared.TableLogOnInfo tbllogin.ConnectionInfo.UserID = "admin" tbllogin.ConnectionInfo.Password = "password_here" tbllogin.ConnectionInfo.DatabaseName = "path_to_db_here" tbl.ApplyLogOnInfo(tbllogin) Next CRV.ReportSource = rpt
www.crystalreportsbook.com
this url steps you through the whole process, especially chapter 14