
Changing database name in ODBC User DSN
Background:
I have a VB6 application which uses ADO 2.1 to connect to an Access
2000 database, and subsequently uses
Crystal Reports 7 (MR1) for
reporting. I need to execute paramaterized queries directly through
the Crystal Report, so have to use an ODBC connection for the Crystal
Reports.
My application allows users to create a number of databases, each of
which will be based on a template mdb and so will have identical
structure (queries and tables), but will have varying data depending on
what they import into each database. The same set of Crystal Reports
are available for any of the databases that the user has set up, but
when a report is run, it must refer to the database the user is
currently working with.
Problem:
When referring to an ODBC database through Crystal Reports, you cannot
change the database being used (only which data source is being used,
and it is not practical to have a DSN for each database the user sets
up). Is there an API call, or some other way from VB to edit the name
of the database in the ODBC User DSN. (I have tracked down the entry
in the registry under: HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\<My
Datasource name>\DBQ="c:\data\abc12345.mdb", so I guess there is always
the option of a direct registry hack, but I would prefer an actual call
if there is one). Any ideas out there??
* Sent from RemarQ http://www.*-*-*.com/ The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!