标题: 如何用编写ADO函数返回Recordset数据集 [打印本页] 作者: LeeTien 时间: 2010-2-20 14:06 标题: 如何用编写ADO函数返回Recordset数据集 看了半天资料,最终做出来无法使用,高手给看看,自定义函数如下:
Function ADOSql(sql As String) As ADODB.Recordset
Set Con = New ADODB.Connection
Set rs = New ADODB.Recordset
With Con
.Provider = "SQLOLEDB"
.CommandTimeout = 5
.ConnectionTimeout = 10
.IsolationLevel = adXactCursorStability '设置隔离级别
End With
Con.Open "SERVER=192.168.1.200;Data=ERP;UID=sa;pwd="
rs.Open sql, Con, adOpenKeyset, adLockReadOnly
Set rsl = rs
End Function作者: zhuyiwen 时间: 2010-3-15 11:31
Function ADOSql(sql As String) As ADODB.Recordset Dim Con As ADODB.Connection
Dim rs AS ADODB.Recordset
Set Con = New ADODB.Connection
Set rs = New ADODB.Recordset
With Con
.Provider = "SQLOLEDB"
.CommandTimeout = 5
.ConnectionTimeout = 10
.IsolationLevel = adXactCursorStability '设置隔离级别
End With
Con.Open "SERVER=192.168.1.200;Data=ERP;UID=sa;pwd="
rs.Open sql, Con, adOpenKeyset, adLockReadOnly
Set ADOSql = rs
End Function作者: li-lin3000 时间: 2011-1-14 08:09
学习了作者: zhanglf123 时间: 2011-3-3 14:33
学习学习