用MsChart做啊,这是我写的用饼图显示数据库里男女比例的例子,看看有用不. Private Sub Form_Load() Dim RSName As ADODB.Recordset '定义一记录集变量 Dim ssql As String Dim vntx(1, 1 To 2), inti As Integer Dim vnty(1 To 2) Dim myconnection As New ADODB.Connection myconnection.ConnectionString = "driver={SQL Server};" & "server=jxrj-36;uid=;pwd=;database=tushuguanli" myconnection.Open ssql = " select count(*) From reader where rsex ='女'" Set RSName = myconnection.Execute(ssql) vntx(1, 1) = RSName.Fields(0) RSName.Closessql = " select count(*) From reader where rsex ='男'"Set RSName = myconnection.Execute(ssql) vntx(1, 2) = RSName.Fields(0)RSName.Close MSChart2.ChartData = vntx End Sub
请给点点
[email protected]
我的邮箱,贴出链接也行!
Private Sub Form_Load()
Dim RSName As ADODB.Recordset '定义一记录集变量
Dim ssql As String
Dim vntx(1, 1 To 2), inti As Integer
Dim vnty(1 To 2)
Dim myconnection As New ADODB.Connection
myconnection.ConnectionString = "driver={SQL Server};" & "server=jxrj-36;uid=;pwd=;database=tushuguanli"
myconnection.Open
ssql = " select count(*) From reader where rsex ='女'"
Set RSName = myconnection.Execute(ssql)
vntx(1, 1) = RSName.Fields(0)
RSName.Closessql = " select count(*) From reader where rsex ='男'"Set RSName = myconnection.Execute(ssql)
vntx(1, 2) = RSName.Fields(0)RSName.Close
MSChart2.ChartData = vntx
End Sub