| 网站首页 | 业界新闻 | 群组 | 人才 | 下载频道 | 博客 | 代码贴 | 编程论坛
 雷速体育发帖软件开发QQ118000023 C语言培训|一对一辅导|零基础学编程 LightningChart 快速先进的.Net图表控件

已结贴   问题点数：20  回复次数：10

Option Explicit

Dim rs As New ADODB.Recordset '定义字段
Dim rs1 As New ADODB.Recordset '定义字段
Dim cnn As New ADODB.Connection   '定义数据连接

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                           '打开连接

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 = 1 To 8
'  If arr(j) > arr(j + 1) Then
If arr(j) > arr(j + 1) Or arr(j) = arr(j + 1) Then
T = arr(j + 1): arr(j + 1) = arr(j): arr(j) = T

End If
'        arrstr(t) = arrstr(i)
'
Next j
''MsgBox t & "==>" & j
Next I

For p = 9 To 1 Step -1
For q = 1 To 9
If arr(p) = arr1(q) Then arrstr1(p) = arrstr(q)

Next q
Print arr(p) & "==========>" & arrstr1(p)  ' & rs.Fields(i + 1).Name
'Print arrstr1(p), rs

Next p

Label1(0) = arr(9)
Label1(1) = arr(8)
Label1(2) = arr(7)
Label1(3) = arr(6)
Label1(4) = arr(5)
Label1(5) = arr(4)
Label1(6) = arr(3)
Label1(7) = arr(2)
Label1(8) = arr(1)

Text1(0) = arrstr1(9)
Text1(1) = arrstr1(8)
Text1(2) = arrstr1(7)
Text1(3) = arrstr1(6)
Text1(4) = arrstr1(5)
Text1(5) = arrstr1(4)
Text1(6) = arrstr1(3)
Text1(7) = arrstr1(2)
Text1(8) = arrstr1(1)

End Sub

[此贴子已经被作者于2015-11-17 22:56编辑过]

得分:0

得分:0

[此贴子已经被作者于2015-11-17 22:59编辑过]

得分:0
Option Explicit

Dim rs As New ADODB.Recordset '定义字段
Dim rs1 As New ADODB.Recordset '定义字段
Dim cnn As New ADODB.Connection   '定义数据连接

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                           '打开连接

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 = 1 To 8
'  If arr(j) > arr(j + 1) Then
If arr(j) > arr(j + 1) Or arr(j) = arr(j + 1) Then
T = arr(j + 1): arr(j + 1) = arr(j): arr(j) = T

End If
'        arrstr(t) = arrstr(i)
'
Next j
''MsgBox t & "==>" & j
Next I

For p = 9 To 1 Step -1
For q = 1 To 9
If arr(p) = arr1(q) Then arrstr1(p) = arrstr(q)

Next q
Print arr(p) & "==========>" & arrstr1(p)  ' & rs.Fields(i + 1).Name
'Print arrstr1(p), rs

Next p

Label1(0) = arr(9)
Label1(1) = arr(8)
Label1(2) = arr(7)
Label1(3) = arr(6)
Label1(4) = arr(5)
Label1(5) = arr(4)
Label1(6) = arr(3)
Label1(7) = arr(2)
Label1(8) = arr(1)

Text1(0) = arrstr1(9)
Text1(1) = arrstr1(8)
Text1(2) = arrstr1(7)
Text1(3) = arrstr1(6)
Text1(4) = arrstr1(5)
Text1(5) = arrstr1(4)
Text1(6) = arrstr1(3)
Text1(7) = arrstr1(2)
Text1(8) = arrstr1(1)

End Sub
得分:0

得分:0

[此贴子已经被作者于2015-11-18 09:46编辑过]

得分:0

得分:0

得分:0

If arr(j) > arr(j + 1) Or arr(j) = arr(j + 1) Then
T = arr(j + 1): arr(j + 1) = arr(j): arr(j) = T
T = arrstr(j + 1): arrstr(j + 1) = arrstr(j): arrstr(j) = T
End If

得分:0

• 11
• 1/2页
• 1
• 2