Article ID: 208210
Article Last Modified on 5/17/2007
APPLIES TO
- Microsoft ActiveX Data Objects 2.0
- Microsoft ActiveX Data Objects 2.1
This article was previously published under Q208210
SYMPTOMS
The following procedure results in an Access Violation in Msadce.dll version 2.10.3513.2:
- Use the MSDataShape OLEDB Provider to create a .udl file.
- Use ADO 2.1 with client-side cursors to connect to a .udl file.
- Issue a SHAPE query.
CAUSE
ADO is not able to recognize that you are using the Shape Provider because the connection string contains a reference to a .udl file instead of a reference to the Shape Provider.
RESOLUTION
To work around this problem do either of the following:
Use a connect string instead of the .udl file to open the connection. For example:
Note Make sure that the uid <username> has the appropriate permissions to perform the required operations on the database.cnn.Open "Data Provider=MSDASQL;DSN=Pubs;uid=<username>;pwd=<strong password>;"
- Use server-side cursors.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This problem has been fixed in Microsoft Data Access Components 2.1 Service Pack 2 and later versions. You may download the latest MDAC service pack from the following Microsoft Web site:
MORE INFORMATION
Steps to Reproduce Behavior:
- Create a .udl file using Microsoft Data Links. To do so, right-click on the Windows desktop, point to New, and select Microsoft Data Link. Use the MSDataShape Provider and reference a DSN pointing to the Pubs database in SQL Server.
Note Under Windows 2000, Microsoft Data Links does not display on the New menu when you right-click on the Desktop. To create a data link file under Windows 2000, create a text file, and then rename it using a UDL filename extension.
For additional information, click the article number below to view the article in the Microsoft Knowledge Base:244659 MDAC 2.5 Sample How to Create a Data Link File with Windows 2000
Create a blank Visual Basic standard exe project, insert a command button into form1, and add the following code to the Click Event:
Dim cnn As New ADODB.Connection Dim rst As New ADODB.Recordset Dim rsChapter As Recordset 'Variant cnn.CursorLocation = adUseClient cnn.Open "File Name=c:\data sources\pubs.udl" rst.Open "SHAPE {select * from authors}APPEND ({select * from titleauthor} AS chapter RELATE au_id TO au_id)", cnn
Keywords: kbado210sp2fix kbbug kbdatabase kbfix KB208210