The information in this article applies to:
SUMMARYWhen you use a connection string that does not use a data source name (a DSN-less connection string) to connect to an external data source in Microsoft Excel 97, information that is required to connect to the external data source is stored in the file structure of the workbook instead of in the data source name. Microsoft Query 97 and Microsoft Excel 97 use this kind of DSN-less connection; earlier versions of Microsoft Query and Microsoft Excel do not. MORE INFORMATIONWhy Are DSN-less Connections Important?In earlier versions of Microsoft Excel, retrieving external data requires that you create a data source. The data source name and other information that is required to connect to the data are stored in hidden names in the worksheet. Therefore, when a workbook that contains references to external data is shared among multiple users, the data source name that is referenced in the connection string must exist on each user's computer. Otherwise, you may receive an error message when you update or edit the external data.In Microsoft Excel 97, once the data is returned to a worksheet, the Structured Query Language (SQL) statement and driver information that is generated from the initial data source (not the data source name) is stored with the worksheet in the file structure of the workbook. These DSN-less connections resolve the issue of maintaining data sources on several computers. All of the necessary information is stored in the workbook itself. However, a copy of the appropriate Open Database Connectivity (ODBC) driver must be installed on each computer for the queries to function. What Does a DSN-less Connection String Look Like?The following is an example of a DSN-less connection string:
Note that there are no references to the DSN keyword in the text.
More About Data Source FilesMicrosoft Query version 2.0 stores data source information in the registry. Microsoft Query 97 does not use the registry to store data source information. Instead, when you create a new data source, the connection information is stored in a text file with a .dsn file name extension. This file is also known as a File DSN.Each File DSN contains an ODBC section and an optional Microsoft Office section that may contain information, such as the default table, password, and user ID for a given data source. The following is the default folder that is used when you save a File DSNX
The following is the default folder that is used when you save a query:
You can specify which folders are included in the search for File DSNs,
including network locations.
The following is an example File DSN that uses the Microsoft Access 7.0 Database driver (an ODBC driver included with Microsoft Office 97):
When you create a File DSN that references a file that is located on the
network and you map the network drive to a specific drive letter, that
drive letter is specified in the File DSN. This behavior may cause problems
if you want to share the File DSN with multiple users across the network
and you want to maintain the File DSN on a server where all users can
access it. To work around this problem, use either of the following
methods.
Method 1Whenever possible, use a universal naming convention (UNC) reference instead of a mapped drive.Method 2Open the File DSN in Notepad and modify the references to the drive letter to use a UNC reference. Consider the following example:
In this example, <drive letter> is the mapped drive and <source filename>
is the source data file.
Change the last two lines to the following
Where <server name> is the network server, <share> is the share on the
network server, and <source filename> is the source data file.
After you modify the file, all users can successfully use the File DSN. For more information about the driver information in the File DSN, please see the Help file that is specific to the ODBC driver you are using. You can also use the 32-bit ODBC Control Panel icon to create a File DSN. To do this, use the following steps:
Microsoft Query 97 Information in the RegistryMicrosoft Query 97 automatically registers itself if the path value for Query is missing in the registry key, or if path value specifies a folder that that does not contain the file. You can reset the location for Microsoft Query 97 in the registry by starting Microsoft Query 97. In Microsoft Windows 95, you can locate Microsoft Query 97 by looking in the following registry key:
When you install Microsoft Office 97, the Setup program creates a registry
key that points to the default location for DSN files. This location is
stored in the following registry key:
You can specify an alternative location for the DSN files by adding the
following registry key.
After you create this key, the key under HKEY_LOCAL_MACHINE is ignored.
REFERENCES
For more information about retrieving data, click the Office Assistant,
type data sources click Search, and then click to view "Ways to retrieve
data from an external database."
Q120802 Office: How to Add/Remove a Single Office Program or ComponentFor additional information, please see the following article in the Microsoft Knowledge Base: Q159557 XL97: Using System, User, and File Data Sources Additional query words: XL97 xlvbmigrate
Keywords : kbprg kbualink97 kbdta KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |