• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 通過LS:DO(ODBC)技術實現Notes訪問DB2/400

    發表于:2007-05-25來源:作者:點擊數: 標簽:通過NotesODBC訪問實現
    在Lotus Notes平臺訪問關系型 數據庫 ,方法主要有以下4種: 1)LS:DO(ODBC):異種平臺互訪數據庫的數據源; 2)DECS:LotusDECS服務; 3)LCLSX:利用LOTUSCONNECTOR的API訪問外部數據庫; 4)LEI(LOTUSENTERPRISEINTERGRATOR):LOTUS的一個工具軟件,用來在不

    在Lotus Notes平臺訪問關系型數據庫,方法主要有以下4種:

    1)LS:DO(ODBC):異種平臺互訪數據庫的數據源;
    2)DECS:Lotus DECS服務;
    3)LC  LSX:利用LOTUS CONNECTOR的API訪問外部數據庫;
    4)LEI(LOTUS ENTERPRISE INTERGRATOR):LOTUS的一個工具軟件,用來在不同的數據平臺上交換數據。 

    本文將對對利用LS:DO(ODBC)技術實現Notes訪問DB2/400數據庫進行介紹。 

    本文將以近期公司實施的海關EDI加貿企業聯網監管系統的Notes端開發片段進行闡述。

    1、 Notes端創建對應AS/400端需要訪問數據的PF文件(ZICTLP)的DDS結構的表單,其中域欄表示Notes端的字段,FIELD ID欄是DDS定義的字段:

    2、表單創建完畢,接著創建對應的View,添加『更新參數表』按鈕:

    ☆『更新參數表』按鈕后臺對應的LotusScript語言如下:

    Sub Click(Source As Button)
     
     Dim ws As New NotesUIWorkspace
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim doc As NotesDocument
     Dim FullFileName As String
     
     Set db = session.CurrentDatabase
     
     Dim view As NotesView
     Dim collection As NotesViewEntryCollection
     Dim entry As NotesViewEntry
     
     Set view = db.GetView("EDI參數表")
     Set collection = view.AllEntries
     Set entry = collection.GetFirstEntry()
     While Not(entry Is Nothing)
      Set doc = entry.Document
      doc.Remove(True)
      Set entry = collection.GetNextEntry(entry)
     Wend
     
     Call ws.ViewRefresh
     
     
        'Create Connection object
     Set Con = New ODBCConnection
     
         'Connect to data source 'R21AFLB1'
     Dim ds As String, user As String, pw As String
     ds   = "R21AFLB1"
     user = "RINKS211"
     pw   = "RINKS211"
     retcode% = Con.ConnectTo( ds, user, pw )
     
         'Exit if Connection failed
     If ( retcode% = False ) Then
      Msgbox "不能正常連接數據源:" + ds
      error% = conn.GetError
      extendedMessage$ = conn.GetExtendedErrorMessage(error%)
      Msgbox extendedMessage$
      Exit Sub
     End If
     
         'Create Query object
     Set Qry = New ODBCQuery     
     
         'Assign  Connection to Query
     Set Qry.Connection = Con 
     
         'Assign SQL Query  
     Qry.SQL = " Select * from ZICTLP where CTLTAG='I' "
     
         'Create ResultSet Object
     Set Res = New ODBCResultSet
     
         'Assign Query to ResultSet
     Set Res.Query = Qry
     
         'Execute Query    
     retcode% = Res.Execute
     
         'Exit if Execute failed
     If ( retcode% = False ) Then
      Msgbox "不能執行查詢:" + Qry.SQL
      error% = data.GetError
      extendedMessage$ = data.GetExtendedErrorMessage(error%)
      Msgbox extendedMessage$
      Exit Sub
     End If
     
         'If No ResultSet then Exit sub
     If Not Res.IsResultSetAvailable() Then
      Msgbox "沒有找到記錄!"
      Exit Sub
     End If
     
     
     Do  
      Res.NextRow
      
      Set doc = db.CreateDocument
      doc.Form = "ZICTLP"
      
      'Transfer data from zictlp  
      doc.XCTLITM       = Res.GetValue("CTLITM")
      doc.XCTLNO        = Res.GetValue("CTLNO")
      doc.XCTLHS        = Res.GetValue("CTLHS")
      doc.XCTLHSB      = Res.GetValue("CTLHSB")
      doc.XCTLCML      = Res.GetValue("CTLCML")
      doc.XCTLEML      = Res.GetValue("CTLEML")
      doc.XCTLCUR      = Res.GetValue("CTLCUR")
      doc.XCTLTAG      = Res.GetValue("CTLTAG")
      doc.XCTLDAT      = Res.GetValue("CTLDAT")
      doc.XCTLFT1      = Res.GetValue("CTLFT1")
      
      
      Call doc.Save(False,False)
      
     Loop Until Res.IsEndOfData
     
     Call ws.ViewRefresh
     
     con.Disconnect
     
    End Sub


    3、Notes客戶端配置R21AFLB1為數據源名稱的ODBC。

    控制面板—管理工具—數據源(ODBC)—系統DSN,添加“Client Aclearcase/" target="_blank" >ccess ODBC Driver (32-bit)”驅動程序。
    在“常規”欄中添加“數據源名:R21AFLB1”。
    在“服務器”欄中指定“SQL缺省庫:R21AFLB1”,出于數據安全,“連接類型”指定為“只讀(只允許Select語句)”。
    為避免出現轉換數據時的不必要麻煩,建議在“轉換”欄把“將二進制數據(CCSID 65535)轉換為文本”選項選上。

    4、需要實現數據從DB2/400—>Notes時,只需要執行『更新參數表』按鈕即可。

    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>