问题 问答题

[conn.asp文档的内容] <% dim db,conn,connstr db="film.mdb" set Corm =server. CreateObject("ADODB.Connection") connstr="provider=microsoft.jet, oledB.4.0;data source="& server. MapPath("data/"&db&"") conn. Ooen connstr 第(1)处 %> [index. asp文档内容] (2) <html> <head> <title>在线电影</title> <style type="text/css"> <!-- td { font-size: 12px; line-height: 17px } body { font-size: 12px; line-height: 17px } p{ margin-top: lpx; margin-bottom: lpx } a:link { text-decoration: none; color: black } a:visited { text-decoration: none; color: black } a:active { text-decoration: none; color: blue } 第(3)处 --> </style> </head> <body lefimargin="0" topmargin="0"> <!--#include file="heaD.asp"--> <div align="center"> 第(4)处 <table> <td height="30" width="367"><%sql="select * from item"set rs_item=server, createobj ect("adodB.recordset")rs_item, open sql,connstr, 1,1response.write "<p><b><IMG onClick=over(this) title=放大 src=images/dot 1.gif><a hre=index.asp>全部电影</a> "do while not rs_item, eof response.write "<IMG onClick=over(this) title=放大 src=images/dot1.gif borde=0><a href=index.aspitem="&rs_item ("name") &">"&rs_item("name")&"</a> " (5) loop 第(6)处 response.write "</b> " rs_item.close %> </td></table> </div> <div align="eenter"> <% dim item_type item_type= (7) if item_type="" or item_type="全部电影" then sq1="select * from data" else sql=" (8) " end if set rs=server, createobject("adodB.reeordset") rs.open sql,connstr, 1,1 %> <table> <tr> <rd width="125" background="imagesfog.gif"height="30">  <IMG onClick=over(this) title=放大 border="0" src="images/biao_le ft.gif" width="15" height="15">影片名字</td> <td width="115" baekground="images/bg.gif"height=-"30" align="center">在线播放</td> <rd width="64" background="images/bg.gif"height="30" align="center"> 电影类型</td> <td width="58" baekground="images/bg.gif"height=-"30" align="eenter">播放格式</td> <td width="43" baekground="imges/bg.gif"height"30"align="center">点击</td> <td width "70" baekground="imagesfog.gif"height="30" align="eenter">加入日期</td> <rd width="73" baekground="images/bg.gif"height="30"align="eenter">推荐度</td> </tr><%do while not rs.eof%> <tr> <rd width "125" height="30" > <IMG onClick=over(this) title=放大 border="0’’ src="images/dian.gif’>  <%=rs ("name")%></td> <td width="115" height="30" align="cente"><a href="">点播</td> <rd width="64" height="30" align="eenter"><a href="index.aspitem=<%=rs("item")%>"> <%=s("item")%></td> <td width="58" height="30" align="center"><%=rsCtype")%></td> (9) <rd width="70" height"30" align="center"><%=rs("date")%></td> <td width="73" height="30" aligd="center"><font color="red"><%=rs("mark")%></a></td></tr> <% rs.movenext 第(10) loop%> </table></div> <!--#include file="foot.asp"--> </body> </html></html>

答案

参考答案:

解析:数据库连接对象conll以Cornnstr中定义的连接字符串打开数据库连接 (2)<!--#includefile="conn.asp"--> (3)当前处于活动超链接<a>中的文字显示为蓝色 (4)<div>标记下的内容居中 (5)rs item.movenext (6)转下一次while循环 (7)Trim(request("item")) (8)select*from data where item=’"&item_type&"’ (9)<tdwidth="43"height="30"align="center"><%=rs("hits")%></td> (10)数据集对象rs移动到下一条记录

[分析]: 试题五 本题考查有关HTML网页制作和ASP编程方面的知识。 某在线娱乐公司实现了一个用于在线点播电影的网页,通过ASP编程用Acess数据表中的数据自动生成一个点播页面“index.asp”。因此本程序涉及Web数据库编程和网页显示。 通过阅读很容易发现Corm.asp程序是用于实现数据库连接的。set Corm= server.CreateObiect("ADODB.Connection")用于生成数据库连接对象,connstr="provider= microsoR.iet.oledB.4.0;datasource="&server.MapPath("data/”&db&"")定义了连接字符串。而语句conn.Open cormstr的作用是打开数据库连接。 index.asp文档的开始处留下了一个填空,我们发现在文档的正文中没有关于数据库连接的ASP语句,因此该空处应该是关于数据库连接的内容。而corm.asp中已经定义了关于数据库连接的语句,这里只需要引用该程序文件即可。 a:active {text-decoration:none;color:blue}是一段CSS代码,其作用是设置当前处于活动超链接<沪中的文字显示为蓝色。<div align="center">用于内容居中。 空(5)和解释(6)处应该联合起来加以考虑,首先看loop的作用很明显是转下一次循环。那么(5)处就应该是数据库移向下一条记录。

单项选择题
单项选择题