本页主题: 求教一个ASP编程问题,ASP达人请进~ 打印 | 加为IE收藏 | 复制链接 | 收藏主题 | 上一主题 | 下一主题

bbsriver
杀人游戏MVP勋章I 杀人游戏MVP勋章II
级别: 管理员


精华: 52
发帖: 17392
威望: 8730 点
金钱: 7074 静电币
支持度: 19001 点
在线时间:13725(小时)
注册时间:2002-11-21
最后登录:2016-12-22

 求教一个ASP编程问题,ASP达人请进~

最近开始学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" -->
这行代码的含义是什么?为什么必须放在调用数据库的代码之前才能正常工作?
这行代码不是已经被<!-- -->注释掉了吗?为什么还在发挥作用?
请指教~
Posted: 2010-08-10 12:49 | [楼 主]
天堂有令
☆圣风
级别: 嘉宾


精华: 0
发帖: 4348
威望: 2770 点
金钱: 0 静电币
支持度: 42 点
在线时间:2889(小时)
注册时间:2006-03-31
最后登录:2019-04-04

 

恩 那个只是include的写法,并不是注释
Quote:
To include a file in an ASP page, place the #include directive inside comment tags:


浏览器是顺序编译的,所以先用到的东西要放在前面,顺序很重要

PS:大头狗发的这个网站可是王牌网站,w3school
Posted: 2010-08-11 10:29 | 1 楼
帖子浏览记录 版块浏览记录
狗狗静电BBS - wwW.DoGGiEhoMe.CoM » 电脑全方位 Computer Guide

沪ICP备05008186号
Powered by PHPWind Styled by MagiColor