- 论坛徽章:
- 0
|
//*******************************************************************************
// Written by Fan [源码系列]从关系数据库中提取数据
// APP: http://item.taobao.com/auction/i ... m_num_id=5105121621
// Lotus_OA_源码交流QQ群:58879202
//********************************************************************************
''''''''''''''''''''''''''''''''''''''''''''''''''''''
Sub Initialize
On Error Goto ErrorRoutine
Set s = New notessession
Set db=s.currentdatabase
sdbfile=getDBPath(getdbpathfile)+"system.nsf"
Set sdb = New notesdatabase(db.server,sdbfile)
Set profile=sdb.GetProfileDocument("AdminForm")
Set view = sdb.getview("employee")
If profile Is Nothing Then
Messagebox "没有设置配置库简要表文档!",MB_OK+64,"提示"
Exit Sub
Else
DataSource=profile.dataSource(0)
UserName=profile.username(0)
Password=profile.password(0)
End If
'''''''''''''''''
Dim con As New ODBCConnection
con.SilentMode = True
If Not con.ConnectTo(DataSource,UserName,Password) Then
Messagebox "不能连到指定的数据源"
Exit Sub
End If
Dim qry As New ODBCQuery
Dim result As New ODBCResultSet
Set qry.Connection = con
Set result.Query = qry
'qry.SQL = "SELECT * FROM "+table
qry.SQL = "SELECT * FROM jq_kqview2"
'Msgbox qry.sql
'Exit Sub
result.Execute
If result.IsResultSetAvailable Then
'while循环测试用
'While i<=10
Do
bm = result.GetValue("d_bm")
bygx = result.GetValue("d_bygx")
byjr = result.getvalue("d_byjr")
byzr = result.getvalue("d_byzr")
byps = result.getvalue("d_byps")
bybsj = result.getvalue("d_bybsj")
'Msgbox bm
'Msgbox bygx
'Exit Sub
'修改个人文档中假期信息
Call updatedoc
result.NextRow
Loop Until result.IsEndOfData
'Wend
result.Close(DB_CLOSE)
Else
Print "没有查询到任何jq_kqview2中的数据!!"
con.disconnect
Exit Sub
End If
con.Disconnect
Exit Sub
ErrorRoutine:
Messagebox "错误:" & Str(Err) & ": " & Error$
Exit Sub
End Sub
看贴要顶,也是一种美德.. |
|