6

I am having a look on an old web application written in the 90s in VB6 and Active Server Pages (JScript). The application retrieves some data from the database and stores it in a recordset which it is using to update. When it attempts to update a field (see below) it gives an '80040e21' error.

rsSave.Fields('text') = Request.Form('strText').Item(i); // this line fails

I have checked the type of the field and it is adVarWChar (202). I have checked the size of the 'text' field which is 2000, way bigger than what is comming from the form. I checked the status of all fields and they are all adFieldOK (0). In other words any of the usual suspects giving normally this error are ok.

The COM+ object that is creating, filling and then returning the recordset is doing the following:

 'Initialize command object
Set oCmd = CreateObject("ADODB.Command")

With oCmd
    .CommandType = adCmdText
    .CommandText = strsql
End With

Set cn = CreateObject("ADODB.Connection")

'Open connection to database
cn.Open strConn
oCmd.ActiveConnection = cn

Set rs = CreateObject("ADODB.Recordset")

     With rs
        Set .Source = oCmd
        .LockType = adLockBatchOptimistic
        .CursorLocation = adUseClient
        .CursorType = adOpenStatic
        .Open
        Set .ActiveConnection = Nothing
       End With

I tried using adLockOptimistic, but no luck.

Last but not least, this application was using initially an old Microsoft OleDb provider for Oracle that was no longer compatible with windows server 2008. We had to use a new provider and since then some things needed to be adjusted in order to work properly.

Any ideas?

Midas
  • 564
  • 6
  • 21
  • What about the `oCmd` object where's the that? – user692942 May 27 '16 at 11:56
  • It is initialized further upp. Set oCmd = CreateObject("ADODB.Command") With oCmd .CommandType = adCmdText .CommandText = strsql End With – Midas May 27 '16 at 12:08
  • And the `strsql` *(can you see a pattern forming...)*? Try not to add code into the comments, just [edit the question](http://stackoverflow.com/posts/37482498/edit) and add the missing code. – user692942 May 27 '16 at 12:10
  • @Lankymart: The strsql is a long query defined further up. It works just fine as it fills the recordset with data (I can see what it contains, it is not EOF). The problem occurs when I try to update a field with a new value. – Midas May 27 '16 at 12:14
  • _We had to use a new provider_ Which one? – Flakes May 27 '16 at 12:17
  • 2
    Possible duplicate of [Getting "Multiple-step operation generated errors. Check each status value." error using ADO with SQL server 2008](http://stackoverflow.com/questions/8040609/getting-multiple-step-operation-generated-errors-check-each-status-value-err) – user692942 May 27 '16 at 12:17
  • @SearchAndResQ: We had to move from MSDAORA to OraOLEDB.Oracle provider. The MSDAORA was not compatible with windows server 2008. – Midas May 27 '16 at 12:32
  • @Lankymart: I was already reading that post and I will try to implement that solution. Thanks anyway! – Midas May 27 '16 at 12:33
  • Good to know information like that would have been useful in the initial question though. – user692942 May 27 '16 at 12:43

1 Answers1

0

I used to get these when I was writing from VB6 to a DB2 database using IBM OLE DB Provider. It was always related to either the data being incompatible with the underlying field type, or the content was too large. Check dates, strings being written into integers, vice versa, etc.

I would try a process of elimination. Write data only one field, defaulting the others to the minimum thy will accept, then keep adding fields with the expected data until it triggers an error. At least it will tell you which field it is.

Sorry I don't have much more to offer.

Kim
  • 136
  • 7