你试试吧,好用的 Dim WithEvents adoPrimaryRS As Recordset '数据库连接对象 Private Sub Command1_Click() 'strsql 是你的查询语句,你可以order by你要排序的字段 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
Private Sub Command1_Click()
'strsql 是你的查询语句,你可以order by你要排序的字段
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
用MSF。他自带了SORT方法。