Hallo Gemeinde,
ich habe nachfolgenden Script geschrieben, dieser funtioniert auch- mit einer Ausnahme. Es wird in der Table das"Mailsentflag" nicht geschrieben. Kann mir an dieser Stelle Jemand weiterhelfen.
Im Notesscripting habe ich doch lediglich den updateRow - oder???
Dim session As New NotesSession
Dim db As NotesDatabase
Dim docmail, Profile As NotesDocument
Set Profile=session.CurrentDatabase.GetProfileDocument("EDI_Profile")
ODBC_Name=profile.GetItemValue("ODBC_Con_Name")
ODBC_Admin=profile.GetItemValue("ODBC_Admin")
ODBC_PW=profile.GetItemValue("PW_ODBC")
Superuser=profile.GetItemValue("Superuser")
Set db = session.CurrentDatabase
Dim con As New ODBCConnection
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
Dim textmail As String
Set qry.Connection = con
Set result.Query = qry
'
If con.ConnectTo(ODBC_Name(0), ODBC_Admin(0),ODBC_PW(0)) Then
qry.SQL = "SELECT MailText FROM EDISendMail where MailSent is NULL"
result.Execute
If result.IsResultSetAvailable Then
Do
result.NextRow
textmail= result.GetValue("MailText")
Call result.SetValue("MailSentFlag)", "Yes")
result.UpdateRow
msg = msg & Chr(10) & Textmail
Loop Until result.IsEndOfData
result.Close(DB_CLOSE)
Else
Exit Sub
End If
con.Disconnect
End If
'Mailversand
Set docmail = db.CreateDocument
Set docmail = New NotesDocument( db )
docmail.Form="Memo"
Call docmail.ReplaceItemValue( "SendTo", Superuser(0))
Call docmail.ReplaceItemValue("Subject","EDI Report " & Today)
Call docmail.ReplaceItemValue("Body",msg)
Call docmail.ReplaceItemValue("ReportDate",Now)
'Call docmail.Save(True,True)
Call docmail.Send( False )