欢迎来到天天文库
浏览记录
ID:59006554
大小:206.13 KB
页数:3页
时间:2020-09-15
《fusionchart控件在vb中的应用连接数据库.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、fusionchart.ocx在vb中的应用*连接SQL下面是源代码:PrivateSubDatabase_Click() 'Variabletostorechartparameters DimchartParametersAsString chartParameters="showValues=0;caption=BusinessResults2007v2008;xAxisName=Month;yAxisName=Revenue;numberPrefix=$" 'Connectionvariable Dimconnectio
2、nAsADODB.Connection 'Recordsetvariable DimdbRecordSetAsADODB.Recordset 'ConnectionstringandSQLcommandvariable DimstrSQLAsString DimconnStringAsString connString="Provider=Microsoft.Jet.OLEDB.4.0;"&"DataSource="&App.Path&"factorydb.mdb;"&"PersistSecurityInfo=False
3、" 'InitializingConnection Setconnection=NewADODB.Connection 'Connectstodatabase Callconnection.Open(connString) 'InitializingRecordset SetdbRecordSet=NewADODB.Recordset 'Settingrecordsetparameter WithdbRecordSet .ActiveConnection=connection .CursorLo
4、cation=adUseClient .CursorType=adOpenDynamic EndWith 'SQLcommand strSQL="SELECT*FROMMSCommon" 'PassingSQLcommandtorecordset CalldbRecordSet.Open(strSQL) 'PassingChartParameters CallFusionCharts1.Data.setChartParams(chartParameters) 'ChangesChartTypetoMSCol
5、umn3D FusionCharts1.ChartType=MSColumn3D 'Addscategorynamesfromdatabase CallFusionCharts1.Data.addCategoryFromDatabase(dbRecordSet,"Months") 'Addsdatasetsseriesnamesmanually CallFusionCharts1.Data.addDataset("2008") 'Addsdatafordatasets(2008) CallFusionCharts1.Dat
6、a.addDataFromDatabase(dbRecordSet,"2008") 'Addsdatasetsseriesnamesmanually CallFusionCharts1.Data.addDataset("2007") 'Addsdatafordatasets(2007) CallFusionCharts1.Data.addDataFromDatabase(dbRecordSet,"2007") 'Callsrenderchartmethod FusionCharts1.RenderChartEndSub程序运
7、行结果如下:
此文档下载收益归作者所有