Where : Populate Agent
(Options)
Option Public
Uselsx "*lsxodbc"
%INCLUDE "LSCONST.LSS"
Uselsx "*lsxodbc"
%INCLUDE "LSCONST.LSS"
(Initialise)
Sub Initialize
'-- Make ODBC Connection
Dim Con As New ODBCConnection
RetCode% = Con.ConnectTo("MRP System")
'-- Define ODBC Query
Dim Qry As New ODBCQuery
'-- Set Connection property of ODBCQuery Object
Set Qry.Connection = Con
'-- Set SQL property of ODBCQueryObject
Qry.SQL = "SELECT * FROM BIKEPART"
'-- Set Query property of ODBCResultSet
Dim res As New ODBCResultSet
Set Res.Query = Qry
'-- Execute the ODBC Query
Res.Execute
'-- Drill down to current database object
Dim Session As New NotesSession
Dim db As NotesDatabase
Set db = Session.currentdatabase
'-- Get First Row in ResultSet
RetCode% = Res.FirstRow
'-- Iterate through result set creating a new document for each row
Do While RetCode% = True
'-- Create new notes document object
Dim Doc As New NotesDocument(db)
'-- Set form item
doc.form = "Bikepart"
'-- Populate document object with values from row
doc.recid = Cstr( Res.GetValue("RECID") )
doc.partno = Res.GetValue("PARTNO")
doc.vendor = Res.GetValue("VENDOR")
doc.type = Res.GetValue("TYPE")
doc.dimension = Res.GetValue("DIMENSION")
doc.cost = Res.GetValue("COST")
'-- Save document
Call doc.save (True, True)
'-- Get Next Row in ResultSet
RetCode% = Res.NextRow
Loop
RetCode% = Res.Close( DB_CLOSE )
RetCode% = Con.Disconnect
End Sub
'-- Make ODBC Connection
Dim Con As New ODBCConnection
RetCode% = Con.ConnectTo("MRP System")
'-- Define ODBC Query
Dim Qry As New ODBCQuery
'-- Set Connection property of ODBCQuery Object
Set Qry.Connection = Con
'-- Set SQL property of ODBCQueryObject
Qry.SQL = "SELECT * FROM BIKEPART"
'-- Set Query property of ODBCResultSet
Dim res As New ODBCResultSet
Set Res.Query = Qry
'-- Execute the ODBC Query
Res.Execute
'-- Drill down to current database object
Dim Session As New NotesSession
Dim db As NotesDatabase
Set db = Session.currentdatabase
'-- Get First Row in ResultSet
RetCode% = Res.FirstRow
'-- Iterate through result set creating a new document for each row
Do While RetCode% = True
'-- Create new notes document object
Dim Doc As New NotesDocument(db)
'-- Set form item
doc.form = "Bikepart"
'-- Populate document object with values from row
doc.recid = Cstr( Res.GetValue("RECID") )
doc.partno = Res.GetValue("PARTNO")
doc.vendor = Res.GetValue("VENDOR")
doc.type = Res.GetValue("TYPE")
doc.dimension = Res.GetValue("DIMENSION")
doc.cost = Res.GetValue("COST")
'-- Save document
Call doc.save (True, True)
'-- Get Next Row in ResultSet
RetCode% = Res.NextRow
Loop
RetCode% = Res.Close( DB_CLOSE )
RetCode% = Con.Disconnect
End Sub
No comments:
Post a Comment