Hello all,
I am connecting from a Windows server to an db2 using sql ,I have the ODBC setting s all fine and I am using this code
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim SettDoc As NotesDocument
Dim agent As NotesAgent
Dim msghdr As String
On Error Goto Errhandle
Set db = session.CurrentDatabase
Set agent = session.CurrentAgent
'Set doc = db.GetDocumentByID(agent.ParameterDocID)
Set doc=session.DocumentContext
Set SettDoc = db.GetProfileDocument("Settings")
msghdr = "DB:PurReq:Agent (Post Expense Hdr): "
Msgbox msghdr+" Starting."
If SettDoc Is Nothing Then
doc.ErrText="No Setting Document found"
Msgbox msghdr+" No Settings Document Found"
Call doc.save(True,True)
Exit Sub
End If
Msgbox("2")
Dim Con As New ODBCConnection
Dim Res As New ODBCResultSet
Msgbox Settdoc.BPCSUser(0)
Msgbox Settdoc.BPCSPassword(0)
Msgbox("3")
con.DataSourceName="AS400"
Msgbox("4")
Call Con.ConnectTo("AS400",Settdoc.BPCSUser(0),Settdoc.BPCSPassword(0))
'If Not Con.ConnectTo("AS400",Settdoc.BPCSUser(0),Settdoc.BPCSPassword(0)) Then
'' Messagebox "Could not connect to the ODBC System. Error Connecting."
’ Exit Sub
'End If
Messagebox con.GetErrorMessage
Msgbox("1")
Dim Qry As New ODBCQuery
Set Qry.Connection = Con
Dim sqlstr As String
sqlstr = "INSERT INTO lib.table(JHID,JHCOMP,JHYEAR) VALUES ('JU','55',2008)"
Qry.SQL=sqlstr
Set Res.Query = Qry
If (Not res.UpdateRow) Then
Print "Error in update: " & res.GetExtendedErrorMessage(res.GetError)
End If
Errhandle:
Messagebox "Error" & Str(Err) & ": " & Error$
Res.Close( DB_CLOSE)
Con.Disconnect
End Sub
in the log I get upto message box(“4”) then
Error 720: LS:DO- ODBC could not complete the requested operation.
any advise
Thanks