bbsriver |
2010-08-10 12:49 |
最近开始学ASP。基础的变量和语法都还没看,靠着以前学过点VBA和PHP的底子,就直接看网页代码。遇到看不懂的代码再直接去搜每个语句的含义。夹生饭似的学下去。
结果遇到这么一段代码:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <% article_id=cint(trim(request.querystring("id"))) %> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <link href="images/cssBasic.css" rel=stylesheet" type="text/css" /> <link href="images/cssLawCase.css" rel="stylesheet" type="text/css" /> <!--#include file="include/connect_mysites_new.asp" --> <% set rs=Server.CreateObject("Adodb.Recordset") rs.open "select * from Article where id="&article_id,conn,1,1 if not rs.eof and not rs.bof then total_title=rs("title") end if %> <title><%=totle_title%></title> <style type="text/css"> .style1 { width: 233px; } .style2 { width: 1175px; } .style3 { table-layout: fixed; width: 1175px; } </style> </head> <body> ……
如果我把 <% set rs=Server.CreateObject("Adodb.Recordset") rs.open "select * from Article where id="&article_id,conn,1,1 if not rs.eof and not rs.bof then total_title=rs("title") end if %> 这段代码放在 <!--#include file="include/connect_mysites_new.asp" --> 这行语句的前面,就一定会报错:http500 而放在这行语句的后面,网页显示就完全正常。
所以, <!--#include file="include/connect_mysites_new.asp" --> 这行代码的含义是什么?为什么必须放在调用数据库的代码之前才能正常工作? 这行代码不是已经被<!-- -->注释掉了吗?为什么还在发挥作用? 请指教~ |
|