Changing database name in ODBC User DSN 
Author Message
 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!



Thu, 23 May 2002 03:00:00 GMT  
 Changing database name in ODBC User DSN
If you do deside to hack the reg-datebase, remember to do the same in the
file named ODBC.INI in WINDOWS/SYSTEM. Otherwise it will not work....

Frank

Quote:
> 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.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!



Fri, 24 May 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Crystal and ODBC DSN/DSN-less connections - do I need USER DSN or SYSTEM DSN

2. change Database Name in DSN?

3. which Dsn(Data Source Name) is Faster System DSN Or File DSN

4. changing databases in odbc doesnt change database in report

5. ODBC DSN names

6. Get all ODBC DSN names

7. API function-to get DB Name from ODBC DSN

8. DSN Names using ODBC API

9. get DSN ODBC file name

10. ODBC User DSN

11. Getting the user and/or sytem DSN names from registry

12. Change code to Look for user DSN not SYS

 

 
Powered by phpBB® Forum Software