|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
Access是一种桌面数据库,只适合数据量少的应用,在处理少量数据和单机访问的数据库时是很好的,效率也很高。但是它的同时访问客户端不能多于4个。access数据库有一定的极限,如果数据达到100M左右,很容易造成服务器iis假死,或者消耗掉服务器的内存导致服务器崩溃。静态|阅读器|图形|显示 人人在编写ASP法式的时分,能够要对各类目标以图形的体例显示出来。假如仅仅是柱状图,可以采取画表格的办法。很多投票法式多采取这类办法。假如是饼状图或从数据库中检索数据后再显示,就有些坚苦了.举措也有,本人可以封装excel来完成上述功效,或用deiphi做一个activeform传入参数,或用php来写,java也能够。固然,用一个对照成熟的图形组件来完成更好一些。microsoft office web compoent十分不错。我在开辟一个项目标时分,用到了这个组件。
CHART.ASP法式。
<% Option Explicit %>
<!--#include file="adovbs.inc"-->
<HTML>
<HEAD>
<TITLE>柱状图的例子</TITLE>
<%
Function ExportChartToGIF(objCSpace, strAbsFilePath, strRelFilePath)
Dim strFileName
Randomize
strFileName = Timer & Rnd & ".gif"
objCSpace.ExportPicture strAbsFilePath & "\" & strFileName, "gif", 650, 400
ExportChartToGIF = strRelFilePath & "/" & strFileName
End Function
Sub CleanUpGIF(GIFpath)
Dim objFS
Dim objFolder
Dim gif
set objFS = Server.CreateObject("Scripting.FileSystemObject")
set objFolder = objFS.GetFolder(GIFpath)
for each gif in objFolder.Files
if instr(gif.Name, ".gif") > 0 and
DateDiff("n", gif.DateLastModified, now) > 10 then
objFS.DeleteFile GIFpath & "\" & gif.Name, True
end if
next
set objFolder = nothing
set objFS = nothing
End Sub
%>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<div align="center">
<br>
<br>
<%
dim sj1,sj2
sj1=Request.QueryString("s1")
sj2=Request.QueryString("s2")
dim objChartSpace
dim objChart
dim objSeries
dim objConn
dim objRS
dim c
dim series
dim strChartAbsPath
dim strChartRelPath
dim strChartFile
dim axis
strChartAbsPath = Server.MapPath("/xjsi-web/dCSS/chart")
strChartRelPath = "/xjsi-web/dcss/chart"
'设置组件
set objChartSpace = Server.CreateObject("OWC.Chart")
set objChart = objChartSpace.Charts.Add
set c = objChartSpace.Constants
objChartSpace.Border.Color="red"
'以柱状图显示
objchart.type=1
objChart.HasLegend = True'是不是显示图例
objChartSpace.HasChartSpaceTitle=true '显示题目
objChartSpace.ChartSpaceTitle.Caption ="柱状图的例子利用office web组件--www.ourfly.com中文手艺网站"
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open application("strconn")
set objRS = Server.CreateObject("ADODB.Recordset")
set objRS.ActiveConnection = objConn
objRS.CursorType = adOpenStatic
objRS.CursorLocation = adUseClient
objRS.Open "select dwsj,sum(jfrs) as jfrs
from dcss_do_jfgcfxb where dwsj>='"&sj1&"' and dwsj<'"&sj2&"'
group by dwsj order by dwsj asc"
set objChartSpace.DataSource = objRS
'显示图例内容
objChart.SetData c.chDimSeriesNames, 0, "jfrs"
for each objSeries in objChart.SeriesCollection
objSeries.SetData c.chDimCategories, 0, "dwsj"
objSeries.SetData c.chDimValues, 0, "jfrs"
next
for each axis in objChart.Axes
axis.HasTitle = True
if axis.Type = c.chCategoryAxis then
axis.Title.Caption = "月份"
else
axis.Title.Caption = "人数"
end if
next
strChartFile = ExportChartToGIF(objChartSpace, strChartAbsPath, strChartRelPath)
Response.Write "<IMG SRC=""" & strChartFile & """>" & "<P>"
CleanUpGIF strChartAbsPath
objRS.Close
set objRS = nothing
set objConn = nothing
set objSeries = nothing
set objChart = nothing
set objChartSpace = nothing
%>
</div>
</BODY>
</HTML>
利用这个组件的注重事项:
1。在office2000的光盘上,有一个msowc.msi的可履行文件.OK
2。建议人人用visual interdev6.0开辟,代码的主动提醒功效此时会发扬出极大的感化。
后果图以下:
</p> asp可以使用微软的activeX 使得网页功能无比强大,不过安全性也较差,而且是基于的windows服务器,所以性能稳定性也一般 |
|