ADODB.Connection
题目
ADODB.Connection
Public dbConn As ADODB.Connection
Public stuRs As ADODB.Recordset
Public SqlFindStr As String
Public Function Conn2DB() As Boolean
'公共Access数据库连函数
Dim connStr As String
Dim dbName As String
dbName = App.Path & "\" & "StudentDB.mdb"
' Access连接字符串
conStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbName
Set dbConn = New ADODB.Connection
If dbConn.State adStateOpen Then
dbConn.Open conStr
End If
Conn2DB = True
End Function
Public Function ExcSQL(ByVal sql As String) As ADODB.Recordset
Dim rst As ADODB.Recordset
'执行一条SQL查询,得到一个记录集
Set rst = New ADODB.Recordset
rst.Open Trim$(sql),dbConn,adOpenKeyset,adLockOptimistic
Set ExcSQL = rst
End Function
中间的几局长的代码最不懂是什么意思,还请大虾们指教!
答案
Public dbConn As ADODB.Connection '定义一个ADODB连接Public stuRs As ADODB.Recordset '定义Recordset对象Public SqlFindStr As StringPublic Function Conn2DB() As Boolean'公共Access数据库连函数Dim connStr ...
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
热门考点