Microsoft KB Archive/293387

= FIX: Recordset.Open Fails When DSN Value Is Not Prefaced with &quot;DSN=&quot; in Connection String =

Article ID: 293387

Article Last Modified on 5/8/2002

-

APPLIES TO


 * Microsoft ActiveX Data Objects 2.6

-



This article was previously published under Q293387



SYMPTOMS
When the data source name (DSN) is not prefaced with &quot;DSN=&quot; in Microsoft Data Access Components (MDAC) or ADO version 2.6, the Recordset.Open ,  method returns the following error message:

Data source name not found and no default driver specified

This behavior does not occur if an ADODB.Connection object is used.



RESOLUTION
To resolve this problem, obtain the latest service pack for Microsoft Data Access Components 2.6. For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

300635 INFO: How to Obtain the Latest MDAC 2.6 Service Pack

There are two ways to work around this problem:   Add &quot;DSN=&quot; to the connection string when it is intended to be used with an ADODB.Recordset.Open call. For example: Dim objRS as New ADODB.Recordset objRS.Open &quot;SELECT CustomerID, CompanyName FROM CUSTOMERS&quot;, _ &quot;DSN=NorthwindDSN&quot; 'Do Recordset work here. objRS.Close Set objRS = Nothing   Specify the appropriate OLE DB Provider and Data Source in your connection string as follows: Dim objRS as New ADODB.Recordset objRS.Open &quot;SELECT CustomerID, CompanyName FROM CUSTOMERS&quot;, _ &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; &quot;Data Source=c:\path to file\Nwind.mdb&quot; 'Do Recordset work here. objRS.Close Set objRS = Nothing 



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article. This problem was first corrected in Microsoft Data Access Components 2.6 Service Pack 2 and MDAC 2.7.

Additional query words: name value

Keywords: kbbug kbfix kbmdac260sp2fix KB293387

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.