Can't Update XML Recordset
- From: ernestcarroll@xxxxxxxxx
- Date: 9 Aug 2005 13:34:15 -0700
We return an updated XML recordset from a web service call. That part
works great if reading the data. What I want to do is get the results,
update some of the field's data, and use that information to call
another web service method. When the code reaches the line
"objRs(1).Value = "ETC"" in the AltMethod procedure we are getting the
following error: "Multi-step operation generated errors. Check each
status value." What are we doing wrong?
This a VB6.0 app. I made some noted mods below to protect the innocent
=)
'********************************************************
Private Sub AltMethod()
Dim objRs As New ADODB.Recordset
Dim objCRS As Object
Dim str As String
str = '** XML Recordset from Web Service **'
' Create Read/Write Recordset
objRs.CursorLocation = adUseClient
objRs.Open GetADOStream(str), , adOpenKeyset, adLockOptimistic,
adCmdFile
While Not objRs.EOF
Text1.Text = Text1.Text & objRs("debtorNo") & vbCrLf &
objRs.RecordCount
objRs.MoveNext
Wend
'MsgBox CStr(objRs.Supports(adUpdate))
objRs.MoveFirst
objRs(1).Value = "ETC" ''' This is where the error occurs!!!
objRs.Update
'objRs.Save , adPersistXML
'Text1.Text = CStr(objRsXML)
objRs.Close
If Not objCRS Is Nothing Then Set objCRS = Nothing
If Not objRs Is Nothing Then Set objRs = Nothing
End Sub
Private Function GetADOStream(strXMLResponse)
Dim objStm As New ADODB.Stream
' Create the ADO stream object
' Set objStm = CreateObject("ADODB.Stream")
' Convert the XML into something an ADO recordset object can read
objStm.Open
objStm.WriteText strXMLResponse
objStm.SetEOS
objStm.Position = 0
' Return recordset XML stream
Set GetADOStream = objStm
Set objStm = Nothing
End Function
Private Function GetXMLResponse(strRequest, strAction)
Dim strResponse As String
Dim objXML As Object
' Load the MSXML object and send to the server
Set objXML = CreateObject("Msxml2.XMLHTTP.4.0")
objXML.Open "POST", strServer & "/" & strAction, False
objXML.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
objXML.setRequestHeader "Content-Length", CStr(Len(strRequest))
objXML.send strRequest ' Commented out for testing...
' Store the server response
strResponse = objXML.responseXML.xml ' Commented out for testing...
' Set objXML to nothing
If Not objXML Is Nothing Then Set objXML = Nothing
' Return the XML string
GetXMLResponse = strResponse
End Function
.
- Follow-Ups:
- Re: Can't Update XML Recordset
- From: nuklehed
- Re: Can't Update XML Recordset
- Prev by Date: Re: Hiding DataGrid Rows
- Next by Date: Re: Mixing SQLConnection.BeginTransaction() and SQL BEGIN TRANS
- Previous by thread: Hiding DataGrid Rows
- Next by thread: Re: Can't Update XML Recordset
- Index(es):
Relevant Pages
|