Dim WithEvents adoPrimaryRS As Recordset '数据库连接对象
Private Sub Command1_Click()
'strsql 是你的查询语句 你可以order by 排序的字段
'strsql="select xh as 学号 from 表" 这里的学号就是你datagrid中列的标题
strsql="select 字段 from 表"
Set Db = New Connection
Db.CursorLocation = adUseClient
'下面的连接数据字符串你要修改一下
Db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\计划管理系统.mdb;Persist Security Info=False"
Set adoPrimaryRS = New Recordset
adoPrimaryRS.Open strsql, Db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = adoPrimaryRS
end sub