Sub ConnDat()
Sub ConnDat()
\'
\' ConnDat Macro
\' ShaoSiMin 记录的宏 2002-8-25
\'
Dim conn As Connection
Dim rs As Recordset
\'连接 SQL SERVER 数据库
Set conn = New Connection
conn.Open "PROVIDER=SQLOLEDB;DATA SOURCE=SHAO4;User ID=sa;Password=12345;DataBase=DF"
\'打开表
Set rs = New Recordset
rs.Open "员工", conn, adOpenForwardOnly, adLockReadOnly
\'关闭表和数据库
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub
\'
\' ConnDat Macro
\' ShaoSiMin 记录的宏 2002-8-25
\'
Dim conn As Connection
Dim rs As Recordset
\'连接 SQL SERVER 数据库
Set conn = New Connection
conn.Open "PROVIDER=SQLOLEDB;DATA SOURCE=SHAO4;User ID=sa;Password=12345;DataBase=DF"
\'打开表
Set rs = New Recordset
rs.Open "员工", conn, adOpenForwardOnly, adLockReadOnly
\'关闭表和数据库
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
End Sub