|
-
Dec 26th, 2003, 11:27 PM
#1
Thread Starter
New Member
Changing MSAccess databases in Crystalreports .net at run time
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.
-
Dec 26th, 2003, 11:48 PM
#2
PowerPoster
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.
-
Dec 26th, 2003, 11:53 PM
#3
Thread Starter
New Member
I need to change the access database at runtime.
This used to be done with datafiles property.
Can you do it in .NET?
-
Dec 27th, 2003, 03:44 AM
#4
Frenzied Member
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
'Heading for the automatic overload'
Marillion, Brave, The Great Escape, 1994
'How will WE stand the FIRE TOMORROW?'
Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979
-
Dec 28th, 2003, 11:54 AM
#5
Hyperactive Member
www.crystalreportsbook.com
this url steps you through the whole process, especially chapter 14
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|