PRB: Open Record Fails When Specifying URL as Active Connection

ID: Q245390


The information in this article applies to:
  • Microsoft Data Access Components version 2.5
  • Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 6.0


SYMPTOMS

When you try to open a record object with a URL specified as the active connection, you might get the following error:

Run-time error '-2147467259 (80004005)': [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.


CAUSE

ADO did not interpret the specified URL as a valid connection string. Since the active connection did not specify any provider, ADO prompts the OLE DB provider for ODBC (MSDASQL), that is the default provider, for more information about the Data Source.


RESOLUTION

Make sure you specify the "URL=" keyword in your source parameter. This lets ADO open the record with the specified URL over which all subsequent record operations apply.


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Start a new Visual Basic project. Form1 is created by default.


  2. Add a Reference to Microsoft ActiveX Data Objects 2.5 Library


  3. Paste the following code in the general declaration section of Form1:


  4. 
    Private Sub Form_Load()
    
          Dim rec As New ADODB.Record
    
          ' The following line would generate error -2147467259. 
          rec.Open "", "http://servername"
    
          ' Comment the above line and uncomment the following line to resolve the problem
          ' rec.Open "", "URL=http://servername"
    
          rec.Close
    
       End Sub 
    NOTE: You should replace "http://servername" with a valid URL from your environment.

  5. Run the above code to notice the behavior.



REFERENCES

For more information on the Record object, please refer to the Platform SDK or to the MSDN Library online.

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Ammar Abuthuraya, Microsoft Corporation

Additional query words: kbGrpMDAC kbDSupport kbMDAC250

Keywords : kbGrpVCDB kbGrpMDAC kbDSupport kbMDAC250
Version : WINDOWS:2.5,6.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: January 3, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.