国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

javascript asp教程Recordset記錄

2024-05-04 11:01:55
字體:
來源:轉載
供稿:網友

Recordset is another created/instanciated Object. It is a collection of data taken from a database. Recordset has 26 properties, 25 methods, 11 events, and two (2) collections. The vast majority of Recordset is beyond the scope of this web site.

Quick Aside:

The database we are using for lesson 16 and lesson 17 is an MS Access 2000 file (not the best database for large sites). The file is called htmlColor.mdb and it has a single Table called colorChart. The database Table has three columns and they are called ID, colorName, and hexValue.

The illustration below shows how we will cycle through these records.

IDcolorNamehexValue
1Aqua00FFFF
2BeigeF5F5DC
3CrimsonDC143C
4Darkviolet9400D3
5ForestGreen228B22
IDcolorNamehexValue
1Aqua00FFFF
2BeigeF5F5DC
3CrimsonDC143C
4Darkviolet9400D3
5ForestGreen228B22
IDcolorNamehexValue
1Aqua00FFFF
2BeigeF5F5DC
3CrimsonDC143C
4Darkviolet9400D3
5ForestGreen228B22

In this example we cycle through the records row by row. We will use the MoveNext() Method to go from record #1 to #2, etc. Then, we will access specific data in each row by using the column name.

Get Started:

Below is the script for Lesson 17. It's exactly the same as the script for lesson 16. The difference is that we will focus on those lines of code that deal with Recordsets.

<%@LANGUAGE="JavaScript"%><!-- METADATA TYPE="typelib" FILE="C:/Program Files/Common Files/System/ado/msado15.dll" --><HTML><BODY><%var myConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="; myConnect += Server.MapPath("http://");myConnect += "http://GlobalScripts//htmlColor.mdb;";var ConnectObj = Server.CreateObject("ADODB.Connection");var RS = Server.CreateObject("ADODB.Recordset");var sql="SELECT ID, colorName, hexValue FROM colorChart;";ConnectObj.Open (myConnect);RS.Open(sql,ConnectObj,adOpenForwardOnly,adLockReadOnly,adCmdText);Response.Write("<TABLE BORDER=/"1/" CELLSPACING=/"0/">/r");Response.Write("<TR><TH>ID</TH><TH>colorName</TH>");Response.Write("<TH>hexValue</TH></TR>/r");while (!RS.EOF)	{	Response.Write("<TR><TD>" +RS("ID")+ "</TD><TD BGCOLOR=/"#");	Response.Write( RS("hexValue")+ "/">" + RS("colorName") );	Response.Write("</TD><TD>" +RS("hexValue")+ "</TD></TR>/r");	RS.MoveNext();	}Response.Write("</TABLE>/r");RS.Close();ConnectObj.Close();RS = null;ConnectObj = null;%></BODY></HTML>            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 巩留县| 察雅县| 高阳县| 宜都市| 鸡泽县| 县级市| 子长县| 济宁市| 宽城| 远安县| 鲁甸县| 通化市| 和平县| 自贡市| 桦甸市| 嘉兴市| 平邑县| 安庆市| 海城市| 岳西县| 福泉市| 卓尼县| 兰考县| 昌平区| 东阿县| 花垣县| 隆回县| 淳化县| 新巴尔虎左旗| 正定县| 福建省| 诸城市| 金乡县| 武平县| 阜新市| 茂名市| 阳原县| 冷水江市| 淳安县| 邢台市| 门头沟区|