标题:asp 代码问题
只看楼主
luckyboy0629
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-9-4
结帖率:0
已结贴  问题点数:20 回复次数:2 
asp 代码问题
各位大侠
为什么一个代码段单独能运行,但是放在另一个页面的一部分不能运行呢?
<%
SET myDBC=SERVER.CREATEOBJECT("ADODB.CONNECTION")
cstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="_
                     &Server.MapPath("data/shows.mdb")
myDBC.OPEN (cstring)
SQL1="SELECT * FROM shows"
SET R1=myDBC.EXECUTE(SQL1)
%>
                  <center>
                    <p class="mainword"></p>
                    <table border=1 class="mainword" >
                      显示商品信息
                      <tr>
                        <td class="mainword">商品名称</td>
                        <td class="mainword">商号质地</td>
                        <td class="mainword">商品单价</td>
                        <td class="mainword">商品库存</td>
                        <td class="mainword">热销程度</td>
                       </tr>
                        <% DO WHILE NOT R1.EOF%>
                      <tr>
                        <td class="mainword"><%=R1("商品名称")%></td>
                        <td class="mainword"><%=R1("商品质地")%></td>
                        <td class="mainword"><%=R1("商品单价")%></td>
                        <td class="mainword"><%=R1("商品库存")%></td>
                        <td class="mainword"><%=R1("热销程度")%></td>
                      </tr>
                      <% R1.MoveNext
                        LOOP %>
                    </table>
                  </center>
搜索更多相关主题的帖子: 信息 center border 商品 
2012-09-04 22:55
luckyboy0629
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2012-9-4
得分:0 
接着来
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<!-- InstanceBegin template="/Templates/sub.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>志玺商品有限公司</title>
<!-- InstanceEndEditable -->
<style type="text/css">
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #F0F0F0;
}
</style>
<link href="useful.css" rel="stylesheet" type="text/css">
<link href="css/useful.css" rel="stylesheet" type="text/css">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1000" height="79" align="left" valign="top"><table width="1000" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="359" height="79" rowspan="2" align="left" valign="top"><img src="images/index_01.gif" width="359" height="79"></td>
          <td height="59" colspan="7" align="left" valign="top" bgcolor="#F0F0F0"></td>
        </tr>
        <tr>
          <td width="111" height="20" align="left" valign="top" bgcolor="#F0F0F0"></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="index.asp" class="titleLink">首  页</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="intro.html" class="titleLink">企业简介</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="shows.html" class="titleLink">产品展示</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="news.html" class="titleLink">新闻中心</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="contact.html" class="titleLink">联系我们</a></td>
          <td width="80" align="left" valign="top" bgcolor="#F0F0F0"></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><table width="1000" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="466" align="left" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->
            <table width="1000" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="492" height="72"><img src="images/shower_02.gif" width="492" height="72"></td>
                <td width="508" height="72"><img src="images/shower_03.gif" width="508" height="72"></td>
              </tr>
              <tr>
                <td height="233" colspan="2" align="center" valign="top">
                <%
SET myDBC=SERVER.CREATEOBJECT("ADODB.CONNECTION")
cstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("data/shows.mdb")
myDBC.OPEN (cstring)
SQL1="SELECT * FROM shows"
SET R1=myDBC.EXECUTE(SQL1)
%>
                  <center>
                    <p class="mainword"></p>
                    <table border=1 class="mainword" >
                      显示商品信息
                      <tr>
                        <td class="mainword">商品名称</td>
                        <td class="mainword">商号质地</td>
                        <td class="mainword">商品单价</td>
                        <td class="mainword">商品库存</td>
                        <td class="mainword">热销程度</td>
                       </tr>
                        <% DO WHILE NOT R1.EOF%>
                      <tr>
                        <td class="mainword"><%=R1("商品名称")%></td>
                        <td class="mainword"><%=R1("商品质地")%></td>
                        <td class="mainword"><%=R1("商品单价")%></td>
                        <td class="mainword"><%=R1("商品库存")%></td>
                        <td class="mainword"><%=R1("热销程度")%></td>
                      </tr>
                      <% R1.MoveNext
                        LOOP %>
                    </table>
                  </center>
              </tr>
              <tr>
                <td width="492" height="162"><img src="images/shower_06.gif" width="492" height="162"></td>
                <td width="508" height="162"><img src="images/shower_07.gif" width="508" height="162"></td>
              </tr>
            </table>
            <!-- InstanceEndEditable --></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td height="58" align="center" valign="middle" class="mainword">志玺商品有限公司版权所有</td>
  </tr>
</table>
</body>
<!-- InstanceEnd -->
</html>
放在这里面总有问题
2012-09-04 23:04
netlin
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:24
帖 子:544
专家分:4308
注 册:2012-4-9
得分:20 
楼主,你试一试,是不是这个地方(用红色字体标出)?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.
<html>
<!-- InstanceBegin template="/Templates/sub.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- InstanceBeginEditable name="doctitle" -->
<title>志玺商品有限公司</title>
<!-- InstanceEndEditable -->
<style type="text/css">
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
    background-color: #F0F0F0;
}
</style>
<link href="useful.css" rel="stylesheet" type="text/css">
<link href="css/useful.css" rel="stylesheet" type="text/css">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body>
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1000" height="79" align="left" valign="top"><table width="1000" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="359" height="79" rowspan="2" align="left" valign="top"><img src="images/index_01.gif" width="359" height="79"></td>
          <td height="59" colspan="7" align="left" valign="top" bgcolor="#F0F0F0"></td>
        </tr>
        <tr>
          <td width="111" height="20" align="left" valign="top" bgcolor="#F0F0F0"></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="index.asp" class="titleLink">首  页</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="intro.html" class="titleLink">企业简介</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="shows.html" class="titleLink">产品展示</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="news.html" class="titleLink">新闻中心</a></td>
          <td width="90" align="right" valign="top" bgcolor="#F0F0F0" class="titleLink"><a href="contact.html" class="titleLink">联系我们</a></td>
          <td width="80" align="left" valign="top" bgcolor="#F0F0F0"></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td><table width="1000" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="466" align="left" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->
            <table width="1000" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="492" height="72"><img src="images/shower_02.gif" width="492" height="72"></td>
                <td width="508" height="72"><img src="images/shower_03.gif" width="508" height="72"></td>
              </tr>
              <tr>
                <td height="233" colspan="2" align="center" valign="top">
                <%
SET myDBC=SERVER.CREATEOBJECT("ADODB.CONNECTION")
cstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("data/shows.mdb")
myDBC.OPEN (cstring)
SQL1="SELECT * FROM shows"
SET R1=myDBC.EXECUTE(SQL1)
%>
                  <center>
                    <p class="mainword"></p>
                    <table border=1 class="mainword" >
                      显示商品信息
                      <tr>
                        <td class="mainword">商品名称</td>
                        <td class="mainword">商号质地</td>
                        <td class="mainword">商品单价</td>
                        <td class="mainword">商品库存</td>
                        <td class="mainword">热销程度</td>
                       </tr>
                        <% DO WHILE NOT R1.EOF%>
                      <tr>
                        <td class="mainword"><%=R1("商品名称")%></td>
                        <td class="mainword"><%=R1("商品质地")%></td>
                        <td class="mainword"><%=R1("商品单价")%></td>
                        <td class="mainword"><%=R1("商品库存")%></td>
                        <td class="mainword"><%=R1("热销程度")%></td>
                      </tr>
                      <% R1.MoveNext
                        LOOP %>
                    </table>
                  </center></td>
              </tr>
              <tr>
                <td width="492" height="162"><img src="images/shower_06.gif" width="492" height="162"></td>
                <td width="508" height="162"><img src="images/shower_07.gif" width="508" height="162"></td>
              </tr>
            </table>
            <!-- InstanceEndEditable --></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td height="58" align="center" valign="middle" class="mainword">志玺商品有限公司版权所有</td>
  </tr>
</table>
</body>
<!-- InstanceEnd -->
</html>

做自己喜欢的事!
2012-09-06 15:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-380704-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.059910 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved