Unconfigured Ad Widget

Collapse

Announcement

Collapse
No announcement yet.

AddNew returns multi-step OLE DB operation generated errors

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • AddNew returns multi-step OLE DB operation generated errors

    I had the same problem before, it seems IBMDA400 does not support the AddNew methods for recordset. change cursor location does not help.

  • #2
    AddNew returns multi-step OLE DB operation generated errors

    Sorry xiabo_sxb I don’t believe it. I mean, c'mon - IBMDA400 is IBM's principal native OLE DB provider for the 400 - expressly designed for ADO programming. Plus, the AddNew method of an ADO recordset is not exactly "arcane" - what other method would you use to add a new row to a recordset?? Finally, IBM even demonstrates AddNew (to add entries to a data queue even) in one of the sample programs shipped with CAE toolkit. In my VB code I have patterned my OPEN DATAQUEUE command (with the queue definition i.e., the fields in the queue entry) based on the field descriptions from an RPGILE source program. I’m betting this is the problem. Since I'm not an RPG programmer, I am guessing at the data type mapping between RPG and OLE DB. Stay tuned. I might post this over in the RPG forum - see what I can turn up.

    Comment


    • #3
      AddNew returns multi-step OLE DB operation generated errors

      Sorry, I may make some mistake, since I never write code to operate data queue. The following is from IBM's redbook: A Fast Path to AS/400 Client/Server Using AS/400 OLE DB Support. I'm not sure if it support this update now. but my version does not support. -------------------------------------------------------------------- AddNew Used to create a buffer that is used to hold data for a potential new record for the recordset. Sample of adding a new record to the recordset: Dim Fields Dim Values Fields = Array("CID", "FNAME", "LNAME") Values = Array(CustID, FirstName, LastName) rsData.AddNew Fields, Values Note: When this redbook was written, the AS/400 OLE DB support provider did not support the following technique to add a record to the AS/400 database. Use the technique shown above to add a record. rsData.AddNew rsData("CID") = CustID rsData("FNAME") = FirstName rsData("LNAME") = LastName rsData.Update ----------------------------------------------------------------- IBMDA400 uses a static cursor for ADO SQL statements. You cannot use the AddNew, Update, Remove method on the Recordset object and update the Table on the AS/400. Any modification to the AS/400 logical or physical file data must be done through SQL statements. ------------------------------------------------------ Once you have opened a data queue, you can only use it for whatever option you specified on the Open. Thus, if a data queue requires both read and write operation, you should open it twice, once for sending and once for receiving. Once a data queue is open you may read fields and current entry values from it. After an open for RECEIVE, all entries are read into the Recordset object, and you are positioned at the first entry. You can read the current entry field values by ordinal position or by field name. The Recordset is not updatable, and the AddNew, Update or Delete methods will return errors.

      Comment


      • #4
        AddNew returns multi-step OLE DB operation generated errors

        Hi Fellow Forum Members I'm using ADO against the IBMDA400 provider to write to an AS/400 data queue. Sporadically, the AddNew returns the Provider error "Multi-step OLE DB operation generated error." Does any one out there know what this means?? In dbforums.com I've seen a suggestion to set the connection's default cursor location to adUseClient (?). I'd be happy to supply more grisly details if necessary. Halp!! You can reach me direct at mbishop76@comcast.net Thanks.

        Comment


        • #5
          AddNew returns multi-step OLE DB operation generated errors

          First, let me say thank you for all the research you've done. Not very often you get that level of help/interest from a stranger. And I appreciate it. To make a long story short - I got it to work (proving once again, I guess, that sometimes the documentation is "right" and sometimes it's "wrong" - BUT, the code either works or it doesn't). In my particular case, I am ONLY writing the data queue - I only OPEN for SEND. The AddNew fields, values DOES work - but you have to be absolutely perfect in how you populate those values. My error was that I populated one of the entries in the values array with an 11-character string - but the field definition allowed only a 10-character string. Silly me. So all you cats out there trying to write data queue entries to the AS/400 from VB (and I'm sure that there must be millions of you) - now you know what error number -2147217887 really means. Thanks again.

          Comment

          Working...
          X