Print Page | Close Window

Connect to different MDB file

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4630
Printed Date: 18 May 2024 at 10:21am


Topic: Connect to different MDB file
Posted By: wasouthpnt
Subject: Connect to different MDB file
Date Posted: 27 Oct 2008 at 7:36am
I have 100 MS Access databases.  All have the same table layout.  Each one is for a different customer.  My question is this:  After I create a .NET 2008 Windows Crystal Report project that connects to one of the databases, how can I then at runtime change the database (mdb file) that the report uses?  I searched everywhere in the code that is created by VS 2008 and could not find any datasource setting that points to the mdb file.  Please let me know if this is possible and what is the preferred method.



Replies:
Posted By: wasouthpnt
Date Posted: 27 Oct 2008 at 8:12am
I have found I can do this in the Form Load event, is this acceptable?

CrystalReport11.DataSourceConnections[0].SetConnection("C:\\DBS\\Customer X\\CustomerX.mdb", "", false);




Print Page | Close Window