这是一个利用datagird datacombo控件 设计学生成绩查询的程序
Option Explicit
Dim conn As ADODB.Connection
Dim WithEvents rs As ADODB.Recordset
Private Sub Command1_Click()
Dim strsql As String
Set conn = New ADODB.Connection
conn.Open "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data.Source=" & App.Path_ & "\library.mdb;" & "persist security info=false"
strsql = "select * from 图书代码 where 书名 like'" & Text1 & "%'order by 类别代码,书名,出版单位 "
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open strsql, conn, adOpenStatic, adLockReadOnly
Set DataGrid1.DataSource = rs
End Sub
Private Sub rs_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
StatusBar1.SimpleText = "当前位置:" & rs.AbsolutePosition & Space(3) & "记录总数:" & rs.RecordCount
End Sub
运行时老是 出错 用户定义类型为定义 这咋办??????