编译错误,"用户定义类型未定义"
Public Function getRS(ByVal sql As String) As ADODB.Recordset '就是这句发生这个什么用户定义类型未定义这个错误.
Dim myconn As New ADODB.Connection
Dim rs As New ADODB.Recordset
strconnection = "Provider=MSDASQL.1;Persist Security Info=False;Extended Properties=" & "DSN=zjnulibrary;Description=图书馆数据;APP=Visual Basic;WSID=ZJNUV;DATABASE=zjnulibrary;Trusted_Connection=Yes"
On Error GoTo getrs_error
rs.open sql, myconn, 3, 3
Set getRS = rs
getrs_exit:
Set rs = Nothing
Set myconn = Nothing
Exit Function
getrs_error:
MsgBox "发生错误:" & Err.Description, vbOKOnly, "错误警告"
Resume getrs_exit
End Function
Public Sub sqlexe(ByVal sql As String)
Dim myconn As New ADODB.Connection
On Error GoTo sqlexe_error
myconn.Execute (sql)
sqlexe_exit:
Set myconn = Nothing
Exit Sub
sqlexe_error:
MsgBox "发生错误:" & Err.Description, vbOKOnly, "错误警告"
Resume sqlexe_exit
End Sub
Sub main()
Dim newfrm As New MDIForm1
newfrm.Show
End Sub