vb6.0中MSchart控件的使用
想用MSchart作曲线图表示温度的变化,通过ADO查询数据库并在Datagrid上显示,如何使MSchart的图根据查询出的数据变化。...
想用MSchart作曲线图表示温度的变化,通过ADO查询数据库并在Datagrid上显示,如何使MSchart的图根据查询出的数据变化。
展开
1个回答
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 '给你做个参考吧
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 '给你做个参考吧
微测检测
2023-10-30 广告
2023-10-30 广告
深圳市微测检测有限公司始创于2005年,是一家综合性、全方位、一站式的权威第三方检测认证公司。自成立以来,Microtest微测检测已成功为上万家企业完成数十万计的产品测试和认证,协助企业的产品畅销全球。Microtest微测检测已建立二十...
点击进入详情页
本回答由微测检测提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |