datalist如何实现点击一次升序,再点一次降序排列? 160
2个回答
展开全部
在datalist的click事件中写 datalist控件的ado数据源就可以了
例子如下 比如绑定的ado源控件是adodc1,表是abc,按id字段排序 点一下顺序 点一下倒序
Private Sub DataList1_Click()
If Adodc1.RecordSource = "select * from abc order by id desc" Then
Adodc1.RecordSource = "select * from abc order by id"
Else
Adodc1.RecordSource = "select * from abc order by id desc"
End If
Adodc1.Refresh
End Sub
例子如下 比如绑定的ado源控件是adodc1,表是abc,按id字段排序 点一下顺序 点一下倒序
Private Sub DataList1_Click()
If Adodc1.RecordSource = "select * from abc order by id desc" Then
Adodc1.RecordSource = "select * from abc order by id"
Else
Adodc1.RecordSource = "select * from abc order by id desc"
End If
Adodc1.Refresh
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询