WEB开发网
开发学院数据库MSSQL Server 将数据库中的数据通过client控件显示,有源代码 阅读

将数据库中的数据通过client控件显示,有源代码

 2007-11-11 10:39:47 来源:WEB开发网   
核心提示:从浏览器到数据库关系:browser mschart controljavascript (client-side)ASP (server-side vbscript)adoodbcdbms==关键在于将 RS 内的内容赋给 client-side javascript.source code:==&l

  从浏览器到数据库关系:
browser
mschart control
javascript (client-side)
ASP (server-side vbscript)
ado
odbc
dbms
==================
关键在于将 RS 内的内容赋给 client-side javascript.
source code:
==================
<%@ LANGUAGE="VBSCRIPT" %>

      <%
        Dim oConn
        Dim oRs
        Dim curDir
        Dim Index


    Dim sqlstring
    sqlstring = "select field from table"

        ' Create ADO Connection Component to connect
        ' with sample database
        
        Set oConn = Server.CreateObject("ADODB.Connection")
        oConn.Open "DSN=localserver;SERVER=(local);UID=sa;PWD=;DATABASE=pubs"
        Set oRs = oConn.Execute(sqlstring)
      %>
      
      
      <script language=vbscript>
      
      <% Response.Write "<!--" %>
Sub Window_onload()
      Dim A
      A = Array(<%  
        Do while (Not oRs.eof) %>
        <% =Int(oRs(0))%>,<% oRs.MoveNext
        Loop
      %>0)


    MSChart1.ChartType = 1
    MSChart1.ChartData = A
    
End sub

      <% Response.Write "-->" %>
      </script>

      <%  
        oRs.close
        oConn.close
      %>




<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
<META HTTP-EQUIV="Content-Type" content="text/HTML; charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY>

<!-- Insert HTML here -->

<OBJECT ID="MSChart1" WIDTH=356 HEIGHT=268
CLASSID="CLSID:31291E80-728C-11CF-93D5-0020AF99504A" CODEBASE="msChart.cab#version=5.0.37.14">
</OBJECT>

</BODY>
</HTML> 

Tags:数据库 数据 通过

编辑录入:coldstar [复制链接] [打 印]
赞助商链接