developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks




UpdateRow error in SQL
Crack Jack 06/10/2013 04:23 AM
General All Releases All Platforms


Hi,

I am writing an agent to update a SQL db from a lotus notes database. If the record is already in SQL, then I need to update it else create a new record.

I am getting error when I am trying to update an existing record. Creating a new record works fine. Below is my code. I searched the forum and followed some of the suggestions but nothing resolved the issue.

Set doc = view.GetFirstDocument
While Not doc Is Nothing
'Get employee id and fetch corresponding record
query.SQL="select * from AD_Users where PID = "+Cstr(doc.PersonID(0))+""
Call result.Execute

If result.IsResultSetAvailable Then 'Update Row
result.LastRow
Call result.SetValue("PID", doc.PersonID(0))
Call result.SetValue("FullName", doc.AltFullName(0))
Call result.SetValue("LastUpdated", Now())
status = result.UpdateRow '-----HERE is the error
Else 'Add new Row
result.AddRow
Call result.SetValue("PID", doc.PersonID(0))
Call result.SetValue("FullName", doc.AltFullName(0))
Call result.SetValue("LastUpdated", Now())
status = result.UpdateRow '-----WORKS fine
End If
result.Close(DB_CLOSE)
Set doc = view.GetNextDocument(doc)
Wend

Error: LS: DO- ODBC could not complete the requested operation

Please help...thanks in advance

Go back