VB 倒数数据库数据到 list 总是不能倒序导入

新点燃 技术  2015-09-24 10:37:45

如图所示,第一条内容时间10:24:30 最后一条10:24:33
我需要的效果是时间越新,越靠前(后导入的数据在前面,类似于手机的收件箱)
我用了按照时间倒序打开数据表,可是没用,求助啊
Private Function Inbox_Update()
Dim tempString As String
Dim tempKind As String
Dim tempName As String
Dim tempNumber As String
List3.Clear

rs_inbox.Open "select * from inbox order by time asc", conn, 2, 2
‘rs_inbox.Open "select * from inbox order by time desc", conn, 2, 2
If rs_inbox.BOF = False Then
rs_inbox.MoveFirst
rs.Open "select * from NAME", conn, 2, 2

While rs_inbox.EOF = False
If IsNull(rs_inbox.Fields("message")) Then
tempString = "空文本"
Else
tempString = rs_inbox.Fields("message")
End If
Select Case rs_inbox.Fields("kind")
Case 0
tempKind = "未知信息"
Case 1
tempKind = "SOS 位置"
Case 2
tempKind = "SOS 信息"
Case 3
tempKind = "上报位置"
Case 4
tempKind = "上报信息"
End Select
If IsNull(rs_inbox.Fields("name")) Then
tempNumber = rs_inbox.Fields("number")
rs.MoveFirst
rs.Find "number= '" & tempNumber & "' "
If rs.EOF Then
tempName = "未命名"
Else
If IsNull(rs.Fields("name")) Then
tempName = "未命名"
Else
rs_inbox.Fields("name") = rs.Fields("name")
End If
End If
Else
tempName = rs_inbox.Fields("name")
End If
If Len(tempName) < 4 Then tempName = tempName + " "
List3.AddItem tempKind + " " + tempName + vbTab + " " + tempString

'If Len(tempString) < 5 Then tempString = tempString + " "
''List5.AddItem tempString + vbTab + " " + rs.Fields("number").Value
rs_inbox.MoveNext
Wend
rs.Close
End If
rs_inbox.Close
UptadeInbox_Flag = 1
End Function
...全文
209 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
新点燃 2015-10-08
rs_inbox.Open "select * from inbox order by [time] desc", conn, 2, 2
回复
新点燃 2015-10-08
引用 1 楼 of123的回复:
试试:select * from inbox order by desc [time]
试试:select * from inbox order by desc [time][/quote] 试试:select * from inbox order by desc [time][/quote] 谢谢1楼的指导,但是你那样有错误 反过来就对了
回复
of123 2015-09-25
试试:select * from inbox order by desc [time]
回复
相关推荐
发帖

1188

社区成员

VB 数据库(包含打印,安装,报表)
申请成为版主
帖子事件
创建了帖子
2015-09-24 10:37
社区公告
暂无公告