mschart控件问题
Set conn = New ADODB.Connectionconn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=ff;Data Source=FENEFN"
conn.Open
Adodc1.RecordSource = "select 名称,所占数量 from xx order by 所占数量 desc"
Adodc2.RecordSource = "select sum(所占数量) as 数量 from xx "
Dim rs As Recordset
Set rs = New ADODB.Recordset
rs.Open "select * from xx", conn, adOpenStatic, adLockOptimistic
MSChart1.ColumnCount = rs.RecordCount
If rs.RecordCount > 0 Then '当记录大于零时
For i = 1 To rs.RecordCount
MSChart1.Column = i
MSChart1.Row = 1
MSChart1.ColumnLabel = rs.Fields(0).Value & "占市场:" & Format(Adodc1.Recordset.Fields(1) / Adodc2.Recordset.Fields(0).Value, "0.00%")
MSChart1.Data = rs.Fields(1).Value
rs.MoveNext
Next i
End If
MSChart1.RowCount = 1
MSChart1.RowLabel = "利用饼型图分析产品市场占有率"
程序运行到MSChart1.ColumnCount = rs.RecordCount这行出现“函数参数错误”,发现MSChart1.ColumnCount 的值为5,rs.RecordCount的值为-1,记录中的值是有5项的!为什么会出现这样的错误? --------------------编程问答-------------------- 补充下,,初始的mschart控件的columncount就是设置的5
补充:VB , 基础类