| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1428 人关注过本帖
标题:求助!排序后重复的只显示一个值,为何?
只看楼主 加入收藏
wmf2014
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:216
帖 子:2039
专家分:11273
注 册:2014-12-6
收藏
得分:20 
这样修改后应该符合你的要求
程序代码:
Option Explicit

Dim rs As New ADODB.Recordset '定义字段
Dim rs1 As New ADODB.Recordset '定义字段
Dim cnn As New ADODB.Connection   '定义数据连接
Private Sub Form_Load()
    Dim strCnn$, SQL As String
    strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\WL.mdb;Jet OLEDB:Database Password="
    cnn.Open strCnn                           '打开连接
    rs.Open "select * from  WL  ", cnn, adOpenDynamic, adLockBatchOptimistic
End Sub

Private Sub Command1_Click()
Dim a As String
Dim arr(1 To 9) As Integer
Dim arr1(1 To 9) As Integer
Dim arrstr(1 To 9) As String
Dim arrstr1(1 To 9) As String
Dim I, j, T, p, q As Integer

For I = 1 To 9
    a = rs.Fields(I + 1)
    arr(I) = Val(a)
    q = I
    arr1(q) = Val(a)
    arrstr(q) = rs.Fields(q + 1).Name
Next I

For q = 1 To 9
Print "+++++++++++++++"; arr1(q) & "==========>" & arrstr(q)
Next q

For I = 1 To 8
    For j = I + 1 To 9
      '  If arr(j) > arr(j + 1) Then
      If arr(I) > arr(j) Then
        T = arr(I): arr(I) = arr(j): arr(j) = T
        T = arrstr(I): arrstr(I) = arrstr(j): arrstr(j) = T
      End If
    Next j
Next I
For p = 9 To 1 Step -1
  Print arr(p) & "==========>" & arrstr(p)  ' & rs.Fields(i + 1).Name
  Combo1.AddItem arrstr(p)
  List1.AddItem arrstr(p)
  Label1(9 - p) = arr(p)
  Text1(9 - p) = arrstr(p)
Next p

End Sub
图片附件: 游客没有浏览图片的权限,请 登录注册


能编个毛线衣吗?
2015-11-18 22:00
快速回复:求助!排序后重复的只显示一个值,为何?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.030153 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved