update chart from a database
Posted: Wed Dec 14, 2005 7:55 am
Public i As Integer
Public CON As New Connection
Private Sub Command1_Click()
Set CON = New Connection
CON.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\" & "TimeStamp.mdb"
Dim rs As New Recordset
rs.Open "Select * from MilliSeconds", CON, adOpenKeyset, adLockOptimistic
rs.AddNew
rs![MilliSec] = Label2.Caption
rs.Update
rs.Close
End Sub
Private Sub Command2_Click()
With TChart1.Series(0)
' remove previous existing points from the Series
.Clear
' add new points to the Series...
' .Add 100, "Europe", vbRed
' .Add 300, "USA", vbBlue
' .Add 200, "Asia", vbGreen
' .Add 120, "Australia", vbYellow
End With
'End Sub
End Sub
Private Sub Command3_Click()
TChart1.Series(0).CheckDataSource
' add new points to the Series...
' .Add 100, "Europe", vbRed
' .Add 300, "USA", vbBlue
' .Add 200, "Asia", vbGreen
' .Add 120, "Australia", vbYellow
' End With
'End Sub
End Sub
Private Sub Form_Terminate()
'MsgBox "Thanks for using.", , "Thanks"
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1
Label2.Caption = Format(Time, "hh:mm:ss")
'+ ":" + Label1.Caption
'''Label1.Caption = Val(Label1.Caption) + 1
'''If Label1.Caption = 100 Then
'''Label1.Caption = 1
'End If
Call run1
Call run
Set CON = New Connection
CON.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\" & "TimeStamp.mdb"
Dim rs As New Recordset
rs.Open "Select * from MilliSeconds", CON, adOpenKeyset, adLockOptimistic
rs.AddNew
rs![MilliSec] = Label2.Caption
rs.Fields(1) = sec.Caption
rs.Update
rs.Close
End Sub
Public Sub run1()
If i = 10000 Then
i = 0
Else
i = i + Timer1.Interval
End If
End Sub
Public Sub run()
sec.Caption = i
End Sub
Here is the code I am using. I want to update the teechart as the values are being populated in the mdb file. So that the graph is running realtime but with values from the database. Please help have uploaded the project in the public attchments folder..
Samir
Public CON As New Connection
Private Sub Command1_Click()
Set CON = New Connection
CON.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\" & "TimeStamp.mdb"
Dim rs As New Recordset
rs.Open "Select * from MilliSeconds", CON, adOpenKeyset, adLockOptimistic
rs.AddNew
rs![MilliSec] = Label2.Caption
rs.Update
rs.Close
End Sub
Private Sub Command2_Click()
With TChart1.Series(0)
' remove previous existing points from the Series
.Clear
' add new points to the Series...
' .Add 100, "Europe", vbRed
' .Add 300, "USA", vbBlue
' .Add 200, "Asia", vbGreen
' .Add 120, "Australia", vbYellow
End With
'End Sub
End Sub
Private Sub Command3_Click()
TChart1.Series(0).CheckDataSource
' add new points to the Series...
' .Add 100, "Europe", vbRed
' .Add 300, "USA", vbBlue
' .Add 200, "Asia", vbGreen
' .Add 120, "Australia", vbYellow
' End With
'End Sub
End Sub
Private Sub Form_Terminate()
'MsgBox "Thanks for using.", , "Thanks"
End Sub
Private Sub Timer1_Timer()
Timer1.Interval = 1
Label2.Caption = Format(Time, "hh:mm:ss")
'+ ":" + Label1.Caption
'''Label1.Caption = Val(Label1.Caption) + 1
'''If Label1.Caption = 100 Then
'''Label1.Caption = 1
'End If
Call run1
Call run
Set CON = New Connection
CON.Open "Provider=Microsoft.Jet.OLEDB.4.0;data source=" & App.Path & "\" & "TimeStamp.mdb"
Dim rs As New Recordset
rs.Open "Select * from MilliSeconds", CON, adOpenKeyset, adLockOptimistic
rs.AddNew
rs![MilliSec] = Label2.Caption
rs.Fields(1) = sec.Caption
rs.Update
rs.Close
End Sub
Public Sub run1()
If i = 10000 Then
i = 0
Else
i = i + Timer1.Interval
End If
End Sub
Public Sub run()
sec.Caption = i
End Sub
Here is the code I am using. I want to update the teechart as the values are being populated in the mdb file. So that the graph is running realtime but with values from the database. Please help have uploaded the project in the public attchments folder..
Samir