首页上一页 1 下一页尾页 2 条记录 1/1页
项目开发实录中图书馆管理系统公共模块的问题
发表在VB答疑区
2009-07-11
是否精华
是
否
版块置顶:
是
否
书中的数据库是ACESS,我需要换成SQL,但是在做完主窗体后,做公共模块时出现了问题,模块代码如下
Public temp, str, BS As String
Public Function cnn() As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_library.mdb;Persist Security Info=False"
End Function
Public Function ESQL(ByVal sql As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_library.mdb;Persist Security Info=False;User ID=sa;Initial Catalog=db_library"
Set rs = New ADODB.Recordset
rs.Open Trim(sql), cnn, adOpenKeyset, adLockOptimistic
Set ESQL = rs
End Function
调试的时候说Public Function cnn() As ADODB.Connection 用户类型未定义.
我想请你们给我讲解一下.
Public temp, str, BS As String
Public Function cnn() As ADODB.Connection
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_library.mdb;Persist Security Info=False"
End Function
Public Function ESQL(ByVal sql As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db_library.mdb;Persist Security Info=False;User ID=sa;Initial Catalog=db_library"
Set rs = New ADODB.Recordset
rs.Open Trim(sql), cnn, adOpenKeyset, adLockOptimistic
Set ESQL = rs
End Function
调试的时候说Public Function cnn() As ADODB.Connection 用户类型未定义.
我想请你们给我讲解一下.