zoukankan      html  css  js  c++  java
  • Lotus Notes 利用Ado防问Access 数据库 .

    Sub Initialize
    Dim oConn As Variant
    Dim oRs As Variant
    Dim filePath As String
    Dim Index As Integer
    Dim vValue As Variant
    Dim strName As String
    Dim strValue As String
    Dim docNew As NotesDocument
    Dim count As Long
    Dim session As New notessession
    Dim db As notesdatabase
    Set db=session.currentdatabase

    getAccessDBData = True
    ' Map contact database to physical path
    strFileName = "C:/MaBase1.mdb"
    'If FileExist( strFileName ) Then
    db.DelayUpdates = True
    ' Create ADO Connection Component to connect with database
    Set oConn = CreateObject("ADODB.Connection")
    oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strFileName
    ' Execute a SQL query and store the results within recordset
    Set oRs = oConn.Execute("SELECT FirstName,LastName,Company From Contacts")

    Do While (Not oRs.eof)
    Set docNew = New NotesDocument( db )
    count = count + 1

    docNew.Form = "Person"
    For Index = 0 To (oRs.fields.count-1)
    strName = oRs(Index).Name
    vValue = oRs(Index).Value
    If Isnull(vValue) Then
    strValue = ""
    Else
    strValue = Cstr(vValue)
    End If
    Call docNew.ReplaceItemValue(strName, strValue)
    Next
    Call docNew.ComputeWithForm(True,False)
    Call docNew.Save(True, False)
    If Not session.IsOnServer Then
    If (count Mod 100) = 0 Then Print Str(count) & " person documents imported."
    End If
    oRs.MoveNext
    Loop


    oRs.Close
    oConn.Close
    Print Str(count) & " person documents imported."
    getAccessDBData = False
    Print "File not Found -> " & strFileName
    End Sub

  • 相关阅读:
    python 全栈开发,Day127(app端内容播放,web端的玩具,app通过websocket远程遥控玩具播放内容,玩具管理页面)
    队列Queue FIFO先进先出 栈Stack FILO先进后出
    sql server 2008 学习笔记
    c#剪切板
    c#复制图片到粘贴板
    C# GUID的使用
    winform自定义控件
    进程和线程
    vs常用快捷键
    c# foreach循环二维数组
  • 原文地址:https://www.cnblogs.com/hannover/p/2235100.html
Copyright © 2011-2022 走看看