您的位置:首页 > 编程语言 > ASP

导出lotus用户的方法(用asp技术)

2004-09-14 14:53 211 查看
lotus用户信息如何导到access中呢。我这里有一个方法,就是先将用户信息引出到文本文件,然后用下面程序输出到access文件中。

<%
'本程序用于将从OA中导出的 用户信息中的一些信息分析出来,并存入数据库中。
'注意1:到出来的文件需要拷贝复制到另一个文本文件中。否则得不到正确结果。
'注意2:如果用户的该项信息不存在则返回 "null" 字符串。
'2004年8月 刘金才
set fso=server.createobject("scripting.filesystemobject")
cFN=server.mappath("tttt.txt")
set fff=fso.getfile(cFN)
set mmm=fff.openastextstream(1)
if not mmm.atendofstream then
    cout=mmm.readall  
end if

Set db=Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("oamail.mdb")
constr="driver={Microsoft Access Driver (*.mdb)};dbq="& DBPath
db.Open constr
db.Execute "delete from oamail"
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from oamail where id is null",db,3,2

uuu=split(cout, "$Revisions:")
hhh=0
set mmm=nothing
set fff=nothing
set fso=nothing

for i=0 to ubound(uuu)
    wangrui=uuu(i)
    xm=getAinfo(wangrui,"LastName:  ",vbcr)
    un=getAinfo(wangrui,"ShortName:  ",vbcr)
    dw1=getAinfo(wangrui,"FullName:  ",vbcr)  
    dw=getAinfo(dw1,"OU=","/O")
    if xm<>"null" and un<>"null" and dw<>"null" then
      rs.AddNew
      rs("xm")=xm
      rs("un")=un
      rs("dw")=dw
      hhh=hhh+1
    end if 
next

rs.Update
rs.Close
db.Close
set rs=nothing
set db=nothing

 

'从一个字符串中截取一个子串
'sString:要被截的子串
'fStr   :子串开头的标志串(不被包含在子串中)
'eStr   :子串结束的标志串(不被包含在子串中)
function getAinfo(sString,fStr,eStr)
       tmpStr="null"
    ln1=instr(1,sString,fStr)
    if ln1>0 then
          ln2=instr(ln1+len(fStr),sString,eStr)
          if ln2>0 then
                 tmpStr= mid(sString,ln1+len(fStr),ln2-ln1-len(fStr))
          end if
    end if
    getAinfo=tmpStr          
end function

%>
操作结束! ,共截取到<%=hhh%>条信息!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐