FIX: Error Updating adUseClient Cursor Based on MDB Query (190108)



The information in this article applies to:

  • ActiveX Data Objects (ADO) 1.5
  • ActiveX Data Objects (ADO) 2.0
  • ActiveX Data Objects (ADO) 2.1 SP2

This article was previously published under Q190108

SYMPTOMS

Trying to update a client-cursor, generated by calling a QueryDef from an MDB causes the following error to appear:
Run-time error '-2147467259(80004005)': Insufficient base table information for updating or refreshing.

CAUSE

Jet does not provide metadata or base table information through IcolumnsRowset. The only other option would be to parse the SQL statement for the metadata. However, it is not possible to parse a stored procedure call.

RESOLUTION

Use a server-side cursor or a straight SQL statement to open the recordset.

STATUS

This problem has been corrected in Microsoft Data Access Components versions 2.5 and later. You may download the latest version of the Microsoft Data Access Components from the following site:

MORE INFORMATION

Steps to Reproduce Behavior

  1. Create a user DSN that points to the Nwind.mdb file.
  2. Create a "Standard EXE" project in Visual Basic.
  3. On the Project menu, click References, and select Microsoft ActiveX Data Objects Library.
  4. Copy and paste the following code into the formForm_Load()event.
       Dim con As ADODB.Connection
       Dim com As ADODB.Command
       Dim res As ADODB.Recordset
       Dim par As ADODB.Parameter
    
       Set con = New ADODB.Connection
       Set com = New ADODB.Command
       Set res = New ADODB.Recordset
    
       con.ConnectionString = "dsn=nwind;usid=admin;pwd=;"
       ' Comment the next line to go around the Update error   
       con.CursorLocation = adUseClient
       con.Open
    
       set com.ActiveConnection = con
       com.CommandText = "{call Invoices}"
       com.CommandType = adCmdText
    
       res.Open com, , adOpenStatic, adLockOptimistic, -1
       res(1) = "test"
       res.Update 'This line causes the error.
    
       res.Close
       con.Close
       Set res = Nothing
       Set com = Nothing
       Set con = Nothing

Modification Type:MinorLast Reviewed:3/2/2005
Keywords:kbADO260fix kbbug kbDatabase kbfix kbJET kbMDACNoSweep kbNoUpdate KB190108 kbAudDeveloper