vb6.0中MSchart控件的使用

想用MSchart作曲线图表示温度的变化,通过ADO查询数据库并在Datagrid上显示,如何使MSchart的图根据查询出的数据变化。... 想用MSchart作曲线图表示温度的变化,通过ADO查询数据库并在Datagrid上显示,如何使MSchart的图根据查询出的数据变化。 展开
 我来答
匿名用户
2013-07-12
展开全部
'窗体中Dim ValueColor(2) As ColorConstants
Const RowCount = 25
Dim rs As New ADODB.Recordset
Dim HideValue(2, 24) As Integer
Private Sub Form_Load()
Call OpenConn
sql = "select 日期,sum(a.处方总金额) as 处方总金额 from user_gs as a group by 日期"
rs.Open sql, cn, adOpenKeyset, adLockReadOnly
ChartShowResult '显示曲线图
End Sub
Private Sub ChartShowResult() '显示曲线图
Dim WinNum As String
Dim WinNumArr(2) As Integer
Dim StrIssue As String
Dim RowI As Integer
Dim SumJO As Integer, SumDX As Integer
RowI = RowCount
If rs.RecordCount = 0 Then Exit Sub
ReDim ss(rs.RecordCount)
With MSCPL3
.RowCount = RowCount 'rs.RecordCount
.ColumnCount = 1 .chartType = VtChChartType2dLine
On Error Resume Next
For i = 1 To RowCount
' RowI = RowI - 1
' If RowI = 0 Then Exit Sub
.Row = i
.Data = rs.Fields("处方总金额")
.RowLabel = Format(rs.Fields("日期"), "mm-dd")
rs.MoveNext
Next i
End With
End Sub '模块中 Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset
Public Sub OpenConn()
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
cn.CursorLocation = adUseClient

' cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\forn.mdb;Persist Security Info=False"
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= D:\社区管理软件\2009\forn.mdb;Persist Security Info=False;Jet OLEDB:Database Password=huang987654"
End Sub
'关闭数据库连接
Public Sub CloseConn()
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub '给你做个参考吧
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式