Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

PRB: Open Record Fails When Specifying URL as Active Connection


View products that this article applies to.

This article was previously published under Q245390

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


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.

↑ Back to the top


Status

This behavior is by design.

↑ Back to the top


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:
    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.

  4. Run the above code to notice the behavior.

↑ Back to the top


References

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

↑ Back to the top


Keywords: KB245390, kbprb

↑ Back to the top

Article Info
Article ID : 245390
Revision : 3
Created on : 9/17/2003
Published on : 9/17/2003
Exists online : False
Views : 479