Public Function getrs(ByVal strquery As String) As ADODB.Recordset
'获得记录集
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
On Error GoTo getrs_error
Set conn = CurrentProject.Connection '打开当前连接
rs.Open strquery, conn, adOpenKeyset, adLockOptimistic, adCmdText
Set getrs = rs
getrs_exit:
Set rs = Nothing '释放当前连接与记录集
Set conn = Nothing
Exit Function
getrs_error:
MsgBox (Err.Description)
Resume getrs_exit
End Function
Public Sub executesql(ByVal strcmd As String) '试行sql语句
Dim conn As New ADODB.Connection
On Error GoTo executesql_error
Set conn = CurrentProject.Connection '打开当前连接
conn.Execute Trim$(strcmd)
executesql_exit:
Set conn = Nothing
Exit Sub
executesql_error:
MsgBox (Err.Description)
Resume executesql_exit
End Sub作者: ui 时间: 2005-4-8 08:04
不知提示什么地方出错作者: e3002 时间: 2005-4-8 08:22
提示错误如下: