Hye, im new here. Need some help on Vb6 coding.
I've look up some of the treads on timing in this site but i have problem implementing it.
Public CHours As Variant
Public CMins As Variant
Public CSecs As Variant
Public CMSecs As Variant
Dim StrNested(4) As String
------------------------------------------------------------
Private Sub cmdSQL_Click()
On Error Resume Next
Adodc1.RecordSource = txtSQL.Text
Adodc1.Refresh
End Sub
-----------------------------------------------------------
Private Sub Combo1_Click()
Label1.Caption = Combo1.List(Combo1.ListIndex)
txtSQL.Text = StrNested(Combo1.ListIndex)
txtSQL.Enabled = False
End Sub
------------------------------------------------------
Private Sub DataGrid1_Click()
Adodc1.Refresh
Timer_1.Enabled = False
End Sub
-------------------------------------------------------
Private Sub Form_Load()
Text1.Text = "00:00:00:00"
Timer_1.Enabled = True
StrNested(0) = "SELECT * from products"
StrNested(1) = "SELECT * from suppliers"
StrNested(2) = "SELECT * from orders"
StrNested(3) = "SELECT * from customers "
StrNested(4) = "SELECT ProductID, ProductName From Products"
Combo1.AddItem "Nested Loop"
Combo1.AddItem "Nested Loop(with Option) "
Combo1.AddItem "Hash Join"
Combo1.AddItem "Merge Join"
Combo1.AddItem "NEW"
End Sub
-------------------------------------------------------
Private Sub Timer_1_Timer()
parts = Split(Text1.Text, ":")
CHours = CInt(parts(0))
CMins = CInt(parts(1))
CSecs = CInt(parts(2))
CMSecs = CInt(parts(3))
If CSecs >= 10 Then
CMins = CMins + 1
CSecs = 0
Else
CSecs = CSecs + 1
End If
If CMins >= 60 Then
CHours = CHours + 1
CMins = 0
End If
If CHours < 10 Then CHours = "0" & CHours
If CMins < 10 Then CMins = "0" & CMins
If CSecs < 10 Then CSecs = "0" & CSecs
Text1.Text = CHours & ":" & CMins & ":" & CSecs & ":" CMSecs
End Sub
-------------------------------------------------------------
I want the timer to start when i press the EXECUTE button(cmdSQL) , and start counting from miliseconds and stop after the result being displayed.
We are able to start the timer after pressing the EXECUTE button but it won't stop even after the data has been retrieve from the database.
We have been using MS SQL Server2000.
Thank you in advanced. :)