//////////////domino数据库数据拷贝(源数据库即:被拷贝的数据库;目的数据库即:存放拷贝数据的数据库)
1 跨数据库拷贝
方法一 :
使用代理拷贝数据
step1: 在数据源库中新建数据拷贝代理,选择代理中的操作,添加操作
step2: 添加操作中选择拷贝到数据库,选择目的数据库,填写好相关信息,保存就 OK
step3: 运行代理。打开一个视图,在新窗口中运行数据拷贝代理,运行拷贝代理需要选中视图中的数据,默认为0条数据
方法二:
使用脚本拷贝数据到目的数据库
/////////////////////////////////////
Dim wk As New NotesUIWorkspace
Dim session As New NotesSession
Dim uiview As NotesUIView
Dim doc As NotesDocument
Dim entrydc As NotesViewEntryCollection
Dim entry As NotesViewEntry
Dim count As Integer
Dim db_oj As NotesDatabase
Dim db As NotesDatabase
Set uiview =wk.CurrentView
count=uiview.Documents.Count
Set db=wk.CurrentDatabase.Database
Dim server As String
Dim serverPath As String
server=db.Server
serverPath="lotus_learn2.nsf"
Set db_oj=session.GetDatabase(server,serverPath)
If count> 0 Then '当前有选中的数据,就拷贝选中的数据 否则就拷贝所有
'Set entrydc=uiview.View.AllEntries
'Set entry=entrydc.GetFirstEntry
For j=1 To uiview.Documents.Count
Set doc=uiview.Documents.GetNthDocument(j)
Call doc.CopyToDatabase(db_oj)
'Set entry=entrydc.GetNthEntry(j)
Next
j=j-1
Msgbox "Over:"+Cstr(j)
Else
Set entrydc=uiview.View.AllEntries
Set entry=entrydc.GetFirstEntry
Dim i As Integer
i=0
While Not entry Is Nothing
Set doc=entry.Document
Call doc.CopyToDatabase(db_oj)
Set entry=entrydc.GetNextEntry(entry)
i=i+1
Wend
Msgbox "Over:"+Cstr(i)
End If
/////////////////////////////////////////////////
lotus基本的四个前台类:NotesUIWorkSpace/NotesUIDocment/NotesUIView/NotesUIDatabase
/////////////////////NotesUIWorkspace的基本方法
属性
CurrentDatabase 返回NOTESUIDATABASE对象
CurrentDocument 返回notesuidocment对象
CurrentView 返回NOTESUIVIEW对象
方法
EditDocument 打开一个记录文档
ViewRefresh 刷新当前视图
////////////////////////////////////////////////
///////////////////////select case 货币数字转换人写币大写
Function getChar(s As String)
Select Case s
Case "1"
getChar="壹"
Case "2"
getChar="贰"
Case "3"
getChar="叁"
Case "4"
getChar="肆"
Case "5"
getChar="伍"
Case "6"
getChar="陆"
Case "7"
getChar="柒"
Case "8"
getChar="捌"
Case "9"
getChar="玖"
Case "0"
getChar="零"
End Select
End Function
Function getCh_money(s As String)
Dim cur As String
Dim lef As String
Dim rig As String
Dim pos As Integer
Dim ch_s As String
cur="万仟佰拾亿仟佰拾万仟佰拾元"
pos =Instr(s,".")+2
s=Left(s,pos) '保证数据小数是2位
lef=Left(s,Len(s)-3)
rig=Right(s,2)
'左边部分的分析
For i=1 To Len(lef)
ch_s=ch_s+getChar(Mid(lef,i,1))+Mid(cur,13-Len(lef)+i,1)
Next
'右边部分的分析
ch_s=ch_s+getChar(Left(rig,1))+"角"+getChar(Right(rig,1))+"分"
getCh_money=ch_s
End Function
////////////////////////
///////////////数字日期与中文日期的转换
Function getChar(s As String )
Select Case s
Case "1"
getChar="一"
Case "2"
getChar="二"
Case "3"
getChar="三"
Case "4"
getChar="四"
Case "5"
getChar="五"
Case "6"
getChar="六"
Case "7"
getChar="七"
Case "8"
getChar="八"
Case "9"
getChar="九"
Case "0"
getChar="0"
End Select
End Function
Function getZh_date(s As String)
Dim y As String
Dim m As String
Dim d As String
Dim date_zh As String
If Len(s)=10 Then
y=Left(s,4)
m=Mid(s,6,2)
d=Mid(s,9,2)
If Instr(m,"0")=1 Then
m=Right(m,1)
End If
If Instr(d,"0")=1 Then
d=Right(d,1)
End If
'年部分
For i=1 To Len(y)
date_zh=date_zh+getChar(Mid(y,i,1))
Next
date_zh=date_zh+"年"
Msgbox date_zh
'月部分
For i=1 To Len(m)
date_zh=date_zh+getChar(Mid(m,i,1))
Next
date_zh=date_zh+"月"
Msgbox date_zh
'日部分
For i=1 To Len(d)
date_zh=date_zh+getChar(Mid(d,i))
Next
date_zh=date_zh+"日"
getZh_date=date_zh
Msgbox date_zh
End If
End Function
////////////////