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

首頁 > 編程 > ASP > 正文

javascript asp教程Recordset記錄

2024-05-04 10:58:20
字體:
來源:轉載
供稿:網友

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>            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 成安县| 海阳市| 纳雍县| 应用必备| 宁陕县| 姜堰市| 凤阳县| 邛崃市| 长乐市| 双辽市| 皮山县| 兴业县| 莱阳市| 承德市| 上虞市| 清原| 鹤壁市| 保德县| 西林县| 南安市| 灌阳县| 北票市| 盘山县| 建平县| 北川| 沾益县| 漳浦县| 元江| 柞水县| 湛江市| 金坛市| 商洛市| 鹰潭市| 灵石县| 广平县| 商丘市| 会东县| 陇南市| 乌恰县| 金平| 玉林市|