zoukankan      html  css  js  c++  java
  • Lotusscript读取MDB文件

    Sub Initialize
        On Error GoTo errhandle
        
        Dim se As New NotesSession
        Dim doc As NotesDocument
        Set doc = se.Documentcontext
        Dim db As NotesDatabase
        Set db = se.Currentdatabase
        
        Dim ConAdmin As String
        Dim con As Variant
        Set con = CreateObject("ADODB.Connection")
        ConAdmin = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=<服务器上的绝对路径>.mdb;Persist Security Info=False"
        con.open ConAdmin
        
        Dim SQL As String
        Dim rs As Variant
        SQL = "select * from BankCode Where CodeType = 'CNAPS'" 
        Set rs=createobject("adodb.recordset")
        rs.open SQL,con,1,3
        If Not rs.eof Then
            
            Dim newdoc As NotesDocument
            Dim itemR As NotesItem
            Dim itemA As NotesItem
            
            rs.MoveFirst
            Do While Not rs.eof
                
                Set newdoc = db.Createdocument() 
                newdoc.form = "frmBankCode"
                newdoc.AllReader = "*"
                newdoc.AllAuthor = "*"
                newdoc.Creater = se.Effectiveusername
                Set itemR = newdoc.Getfirstitem("AllReader")
                Set itemA = newdoc.Getfirstitem("AllAuthor") 
                itemA.Isauthors = True
                itemR.Isreaders = true
                
                newdoc.CodeType = Trim(rs.Fields("CodeType").value) 
                newdoc.BankCode = Trim(rs.Fields("BankCode").value)  
                newdoc.BankName = Trim(rs.Fields("BankName").value)  
                newdoc.BankAddress = Trim(rs.Fields("BankAddress").value)   
                
                Call newdoc.save(True,False)
                
                rs.MoveNext
            Loop
            
        End If
        
        rs.close
        con.close
        
        Set rs = Nothing
        Set con = Nothing
        
        MsgBox "(导入Bank Code):成功。"
        
        Exit Sub
    errhandle:
        MsgBox "(导入Bank Code):" & Erl() & ":" & Error$
        rs.close
        con.close
        
        Set rs = Nothing
        Set con = Nothing
        Exit Sub
    End Sub
  • 相关阅读:
    select,radio,checkbox的美化
    BBMASTER 博客
    thymeleaf教程
    Spring Boot入门01
    thymeleaf
    [转]Eclipse中10个最有用的快捷键组合
    SpringMVC实现文件上传
    Maven_项目管理利器入门
    [转]centos6.5安装mysql
    YOUNG博客项目设计书_v01.00_账号管理模块
  • 原文地址:https://www.cnblogs.com/mysick/p/12731618.html
Copyright © 2011-2022 走看看