用VB做图书馆信息管理系统被卡住了
请各位大虾帮我解决下,人要发疯了!我按照书上的代码抄下来,却报错了,问题是在项目资源管理器中为项目添加一个MODULE,然后写代码,下面是代码,Public Function ExecuteSQL(ByVal SQL As String, MsgString As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sTokens() As String
On Error GoTo ExecuteSQL_Error
sTokens = Split(SQL)
Set cnn = New ADODB.Connection
cnn.Open ConnectString
If InStr("INSERT,DELETE,UPDATE", UCase$(sTokens(0))) Then
cnn.Execute SQL
MsgString = sTokens(0) & "query successful"
Else
Set rst = New ADODB.Recordset
rst.Open Trim$(SQL), cnn, adOpenKeyset, adLockOptimistic
'rst.MoveLast 'get RecordCount
Set ExecuteSQL = rst
MsgString = "查询到" & rst.RecordCount & "条记录"
End If
ExecuteSQL_Exit:
Set rst = Nothing
Set cnn = Nothing
Exit Function
ExecuteSQL_Error:
MegString = "查询错误:" & Err.Description
Resume ExecuteSQL_Exit
End Function
运行是报错,说是 定义类型未定义 。 请帮我解决下 谢谢了