tchart怎么连接数据库,我系那个使用bar显示其中的数据变化情况
展开全部
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim connstr As String
Dim sql As String
Private Sub form_load()
connstr = "driver={microsoft access driver (*.mdb)};dbq=" & App.Path & "\Ex.mdb"
conn.Open connstr
sql = "select * from aaa"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
With TChart1
TChart1.AddSeries (scLine)
.Series(0).Clear
Axis = .Axis.AddCustom(False)
.Axis.Custom(Axis).StartPosition = 0
.Axis.Custom(Axis).EndPosition = 100
.Axis.Custom(Axis).AxisPen.Color = vbRed
.Axis.Custom(Axis).Labels.Font.Color = vbRed
.Series(0).VerticalAxisCustom = Axis
.Axis.Custom(Axis).Maximum = 1500
.Axis.Custom(Axis).Minimum = 0
Randomize
Set TChart1.Series(0).DataSource = rs
TChart1.Series(0).XValues.ValueSource = "编号"
TChart1.Series(0).YValues.ValueSource = "abc"
End With
End Sub
Dim rs As New ADODB.Recordset
Dim connstr As String
Dim sql As String
Private Sub form_load()
connstr = "driver={microsoft access driver (*.mdb)};dbq=" & App.Path & "\Ex.mdb"
conn.Open connstr
sql = "select * from aaa"
rs.Open sql, conn, adOpenKeyset, adLockPessimistic
With TChart1
TChart1.AddSeries (scLine)
.Series(0).Clear
Axis = .Axis.AddCustom(False)
.Axis.Custom(Axis).StartPosition = 0
.Axis.Custom(Axis).EndPosition = 100
.Axis.Custom(Axis).AxisPen.Color = vbRed
.Axis.Custom(Axis).Labels.Font.Color = vbRed
.Series(0).VerticalAxisCustom = Axis
.Axis.Custom(Axis).Maximum = 1500
.Axis.Custom(Axis).Minimum = 0
Randomize
Set TChart1.Series(0).DataSource = rs
TChart1.Series(0).XValues.ValueSource = "编号"
TChart1.Series(0).YValues.ValueSource = "abc"
End With
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询