Draw graphics using chart controls in Office2000 ~

xiaoxiao2021-03-06  40

The table is created using the data in the ADO recordset in the example. First create a string separated by a tab, and then set chart data by setting the setData method and using this string. The following data structure is as shown in Figure: This, can guide from the own database inside SQL Server. The adoConnection1 here can be created through server.createObject (" AdoDb.Connection "), but ChartSpace is created at the server side, I am too clear, So use the client's creation method. <% DIM RS, CATEGORIES, VALUES CATEGORIES = "VALUES CATEGORIES =" VALUES = "" opens the connection to execute the SQL query (create a "nwind.mdb" library, and create a table named "category sales for 1997) Adoconnection1.connectionstring =" Driver = {Microsoft Access Driver (* .mdb)}; DBQ = "& Server.mappath (" nwind.mdb ") adoconnection1.open set = adoconnection1.execute (" Select * from [category sales for 1997] ") Each field record generated a string rs.movefirst do while not rs.movefirst do while not rs.movefirst do while not rs.eof categories = categories & rs.fields (0) .Value & chr (9) Values ​​= VALUES & RS.FIELDS (1) .Value & chr (9) rs.Movenext loop rs.close adoconnection1.close

'Delete the endage of the end of the string categories = Left (Categories, Len (Categories) - 1) Values ​​= Left (VALUES, LEN (VALUES) - 1)%>