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
Lotus Notes 利用Ado防问Access 数据库 .
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
上一篇:分割字符串
下一篇:数据采集之刷cnblog评论
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
access数据库odbc链接 ado连接access数据库
首先在StdAfx.h中加入建立连接:(在xxApp文件中) 1 声明变量 2 建立连接 (1) AfxOleInit 初始化 OL
access数据库odbc链接 access 数据库 properties command