您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 电子商务 > fusionchart控件在vb中的应用连接数据库
fusionchart.ocx在vb中的应用*连接SQL下面是源代码:PrivateSubDatabase_Click()'VariabletostorechartparametersDimchartParametersAsStringchartParameters=showValues=0;caption=BusinessResults2007v2008;xAxisName=Month;yAxisName=Revenue;numberPrefix=$'ConnectionvariableDimconnectionAsADODB.Connection'RecordsetvariableDimdbRecordSetAsADODB.Recordset'ConnectionstringandSQLcommandvariableDimstrSQLAsStringDimconnStringAsStringconnString=Provider=Microsoft.Jet.OLEDB.4.0;&DataSource=&App.Path&\factorydb.mdb;&PersistSecurityInfo=False'InitializingConnectionSetconnection=NewADODB.Connection'ConnectstodatabaseCallconnection.Open(connString)'InitializingRecordsetSetdbRecordSet=NewADODB.Recordset'SettingrecordsetparameterWithdbRecordSet.ActiveConnection=connection.CursorLocation=adUseClient.CursorType=adOpenDynamicEndWith'SQLcommandstrSQL=SELECT*FROMMSCommon'PassingSQLcommandtorecordsetCalldbRecordSet.Open(strSQL)'PassingChartParametersCallFusionCharts1.Data.setChartParams(chartParameters)'ChangesChartTypetoMSColumn3DFusionCharts1.ChartType=MSColumn3D'AddscategorynamesfromdatabaseCallFusionCharts1.Data.addCategoryFromDatabase(dbRecordSet,Months)'AddsdatasetsseriesnamesmanuallyCallFusionCharts1.Data.addDataset(2008)'Addsdatafordatasets(2008)CallFusionCharts1.Data.addDataFromDatabase(dbRecordSet,2008)'AddsdatasetsseriesnamesmanuallyCallFusionCharts1.Data.addDataset(2007)'Addsdatafordatasets(2007)CallFusionCharts1.Data.addDataFromDatabase(dbRecordSet,2007)'CallsrenderchartmethodFusionCharts1.RenderChartEndSub程序运行结果如下:
本文标题:fusionchart控件在vb中的应用连接数据库
链接地址:https://www.777doc.com/doc-2874289 .html