Dim conn As New ADODB.Connection
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim rs3 As New ADODB.Recordset
Dim rs4 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Dim rs6 As New ADODB.Recordset
Dim rs7 As New ADODB.Recordset
'Dim i As Integer
Dim test As Integer
Dim j As Integer
Dim k As Integer
Dim min As Integer
Dim X As Integer
Dim Y As Integer
Dim z As Integer
Private Sub scroll()
Do While True
Dim NewLeft, n As Long
NewLeft = Form1.ScaleWidth
Do While True
LabelMessage.Move NewLeft, 1900
NewLeft = NewLeft - 60
For n = 1 To 20000
DoEvents
Next
'''' 若标签框最末端滚动出窗体视野区域,则重置初始位置
If test = 4 Then
Exit Sub
End If
If NewLeft <= -LabelMessage.Width Then
NewLeft = Form1.ScaleWidth
End If
Loop
Loop
'tuichu:
'MsgBox ("退出程序")
End Sub
Private Sub Command1_Click()
Print "mimaa"
Call Form1.lianjied
Form1.Timer1.Interval = 5000
Call Form1.result
Form1.Show
End Sub
Private Sub Form_Load()
Dim jjjjj As Integer
jjjjj = 200
sj = jjjjj
Label1.BackColor = Form1.BackColor
LabelMessage.BackColor = Form1.BackColor
Label2.BackColor = Form1.BackColor
yi.BackColor = Form1.BackColor
er.BackColor = Form1.BackColor
san.BackColor = Form1.BackColor
class1.BackColor = Form1.BackColor
class2.BackColor = Form1.BackColor
class3.BackColor = Form1.BackColor
Frame1.BackColor = Form1.BackColor
Text1.BackColor = Form1.BackColor
'
Frame2.BackColor = Form1.BackColor
Text2.BackColor = Form1.BackColor
Frame3.BackColor = Form1.BackColor
Text3.BackColor = Form1.BackColor
Frame4.BackColor = Form1.BackColor
Text4.BackColor = Form1.BackColor
'Call connect
'Call result
LabelMessage.AutoSize = True
Label3.AutoSize = True
'Form4.Show
End Sub
Public Sub result()
If (conn.State = 0) Then
Call Form1.lianjied
Form1.Timer1.Interval = 5000
Call Form1.result
Else
Dim i As Integer
Set rs1 = New Recordset
Set rs2 = New Recordset
Set rs3 = New Recordset
Set rs4 = New Recordset
rs4.Open "select count(cPrepay) from tStat where cPrepay=0", conn, adOpenDynamic, adLockOptimistic, -1
rs5.Open "select count(cPrepay) from tStat where cPrepay=0 and sCom like 'a%'", conn, adOpenDynamic, adLockOptimistic, -1
rs6.Open "select count(cPrepay) from tStat where cPrepay=0 and sCom like 'b%'", conn, adOpenDynamic, adLockOptimistic, -1
rs7.Open "select count(cPrepay) from tStat where cPrepay=0 and sCom like 'c%'", conn, adOpenDynamic, adLockOptimistic, -1
rs1.Open "select top 6 sCom from tStat where sCom like 'a%' and cPrepay=0 order by newid()", conn, adOpenDynamic, adLockOptimistic, -1
rs2.Open "select top 6 sCom from tStat where sCom like 'b%' and cPrepay=0 order by newid()", conn, adOpenDynamic, adLockOptimistic, -1
rs3.Open "select top 6 sCom from tStat where sCom like 'c%' and cPrepay=0 order by newid()", conn, adOpenDynamic, adLockOptimistic, -1
class1.Caption = ""
class2.Caption = ""
class3.Caption = ""
Text1.Text = rs4.Fields(0).Value
Text2.Text = rs5.Fields(0).Value
Text3.Text = rs6.Fields(0).Value
Text4.Text = rs7.Fields(0).Value
X = Text2.Text
Y = Text3.Text
z = Text4.Text
If (X < 6) Then
For i = 1 To X
If (rs1.EOF = True Or rs1.BOF = True) Then
Call Form3.lianjied
Form3.Timer1.Interval = 5000
Call Form3.result
Form3.Show
Else
class1.Caption = class1.Caption + " " + rs1.Fields(0).Value
rs1.MoveNext
End If
Next i
Else
For i = 1 To 6
class1.Caption = class1.Caption + " " + rs1.Fields(0).Value
rs1.MoveNext
Next i
End If
If (Y < 6) Then
For j = 1 To Y
If (rs2.EOF = True Or rs2.BOF = True) Then
Call Form3.lianjied
Form3.Timer1.Interval = 5000
Call Form3.result
Form3.Show
Else
class2.Caption = class2.Caption + " " + rs2.Fields(0).Value
rs2.MoveNext
End If
Next j
Else
For j = 1 To 6
class2.Caption = class2.Caption + " " + rs2.Fields(0).Value
rs2.MoveNext
Next j
End If
If (z < 6) Then
For k = 1 To z
If (rs3.EOF = True Or rs3.BOF = True) Then
Call Form3.lianjied
Form3.Timer1.Interval = 5000
Call Form3.result
Form3.Show
Else
class3.Caption = class3.Caption + " " + rs3.Fields(0).Value
rs3.MoveNext
End If
Next k
Else
For k = 1 To 6
class3.Caption = class3.Caption + " " + rs3.Fields(0).Value
rs3.MoveNext
Next k
End If
rs1.Close
rs2.Close
rs3.Close
rs4.Close
rs5.Close
rs6.Close
rs7.Close
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
test = 4
'conn.Close
End
End Sub
Public Sub lianjied()
If (conn.State = 0) Then
conn.ConnectionString = "SERVER=" & Form2.ip & ";PROVIDER=SQLOLEDB" & _
";DATABASE=" & Form2.ming & ";UID=" & Form2.zhanghao & ";PWD=" & Form2.mima
conn.ConnectionTimeout = 5
conn.Open
End If
End Sub
Private Sub Timer1_Timer()
Call result
End Sub
Private Sub Timer2_Timer()
Form1.LabelMessage.Caption = Form4.Text1.Text
Form1.Label3.Caption = Form4.Text2.Text
End Sub
Private Sub Timer4_Timer()
Call scroll
Timer4.Interval = 0
End Sub